DT7.0主动推送当天高质量图片数据到熊掌号展现

      

<?php
/*
百度当天主动推送熊掌功能
作者:68喜科技
用于:DT7.0  
功能模块:优质内容推送熊掌*出图内容当天推送
*/

//引入全局变量函数
defined('IN_DESTOON') or exit('Access Denied');

$time = $today_endtime - 30*86400;

$time = time();

$starttime = $time - 24*3600;//24小时

$limitList=20; //限制条数

$query = "SELECT linkurl FROM {$DT_PRE}article_24 WHERE edittime > $starttime AND thumb<>'' ORDER BY itemid ASC LIMIT $limitList";  //查询当天出图的数据URL

//开始全部推送

$result = $db->query($query);

$urls="";

$domain="http://m.xuetong365.com/story/";

while ($r=$db->fetch_array(($result)))

{

$linkurl = $r['linkurl'];

//修改域名

$urls.=$domain.$linkurl.",";
}

$urls=substr($urls,0,-1);

$urls = explode(",",$urls);


//百度熊掌推送

$api = '熊掌API';

$ch = curl_init();

$options =  array(

    CURLOPT_URL => $api,

    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => implode("\n", $urls),
    CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
echo $result;
 ?>

  

posted @ 2018-07-25 15:00  圆柱模板  阅读(305)  评论(0编辑  收藏  举报