分享好友 资源下载首页 资源下载分类 切换频道

destoon6.0 主动推送24小时内最新链接列表至百度

2016-04-14 14:125228576下载
文件类型:压缩文件
文件大小:0.1M

设置定时任务,


/php根目录/php/bin/php /网站根目录/api/cron/baidu.php


baidu.php文件内容,


//主动推送24小时内最新链接列表至百度


//执行: /php根目录/php/bin/php /网站根目录/api/cron/baidu.php


<?php


require '../../common.inc.php';

$time = time();

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

$query = "SELECt linkurl FROM {$DT_PRE}sell_5 WHERe edittime > $starttime ORDER BY itemid ASC";

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

$urls="";

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

{

$linkurl = $r['linkurl'];

//修改域名

$urls.="https://域名/sell/".$linkurl.",";

}

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

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

//修改下一行

$api = 'https://data.zz.baidu.com/urls?site=域名&token=XXXXXXXXXXXXXXXX';

$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;

?>




登录注册 后查看详情


举报
收藏 0
打赏 0
评论 0