帝国cms的百度推送代码,自己用的,不会用的不要随便尝试,需要修改url,修改数据表,修改百度api密钥
<?php
define('EmpireCMSAdmin','1');
require("e/class/connect.php");
require("e/class/db_sql.php");
require("e/class/functions.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
$num=$empire->num("select id from phome_表");
$randnum=1000;
$randids='';
$randdh='';
for($i=1;$i<=$randnum;$i++)
{
$randids.=$randdh.rand(1,$num);
$randdh=',';
}
$sql=$empire->query("select title,id from phome_表 where id in ($randids) limit $randnum");
while($s=$empire->fetch($sql)){
$urls[] = 'https://www.4s5.cn/geci/'.$s['id'].'.html';//组合url
}
print_r($urls);
$api = 'http://data.zz.baidu.com/urls?site=https://www.4s5.cn&token=密钥';
$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;
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容