<?php
defined('IN_DESTOON') or exit('Access Denied');
$time = time();
$starttime = $time - 24*3600;//24小时
$query = "SELECt linkurl FROM {$DT_PRE}article_21 WHERe edittime > $starttime ORDER BY itemid ASC";
$result = $db->query($query);
$urls="";
while ($r=$db->fetch_array(($result))){
$linkurl = $r['linkurl'];
//添加手机端url
$urls.="{$EXT[mobile_url]}".$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);
$jieguo = date('Y-m-d H:i:s',time())."返回结果:".$result."\r\n";
$numbytes = file_put_contents('file/cache/xz.txt', $jieguo); //执行记录
?>
复制代码然后在后台-定时任务中添加一个任务,任务名称随意,脚本文件选择刚才创建的xzh.inc.php,并设置好合适的执行方式,保存即可!
执行成功之后访问根目录下file/cache/xz.txt,查看执行结果