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

  2019-02-07    阅读:106

设置定时任务,


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

?>


免责声明:
本站部份内容系网友自发上传与转载,不代表本网赞同其观点;
如涉及内容、版权等问题,请在30日内联系,我们将在第一时间删除内容!

相关Destoon技术

(c)2012-2023 www.qiyeyunshang.com All Rights Reserved.
慧一科技destoon模板   辽ICP备2021002520号-1
  QQ咨询

购买模板 售前咨询

  咨询QQ

3292628658
(早8:30-晚10:00)

  微信咨询

咨询微信
客服微信

  返回顶部