代码如下:
<?php
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$urls = array();
$api = '这里填你的API地址,可以百度搜索资源平台->普通收录中获取到';
//以下五项根据具体情况修改即可
$web_root=$_G['siteurl'];//根网址
$CHARSET='utf-8';// or gbk //选择编码方式
$querys = DB::query("SELECT a.tid FROM ".DB::table('forum_thread')." a inner join ".DB::table('forum_forum')." b on a.fid=b.fid ORDER BY a.tid DESC LIMIT 0,10000");
while($threadfid = DB::fetch($querys))
{
$turl=$web_root.'thread-'.$threadfid['tid'].'-1-1.html';//注意静态规则
array_push($urls, $turl);
}
$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;
?>