网上的一些教程都是单独一个表进行推送的,但是我这个是多表查询,共同取最新的信息进行推送!
第一步,我们在网站根目录新建一个PHP文件,如tuisong.php。
注意这里!<?php
require("e/class/connect.php");
require("e/class/db_sql.php");
require("e/data/dbcache/class.php");
$link=db_connect();
$empire=new mysqlquery();
/********密码验证***********/
$key='www.51yma.cn'; //这个密码是登陆验证用的.您需要在模块里设置和这里一样的密码....注意一定需要修改.
if($key!=$_GET['key']) exit('验证密码错误'); //安全检测,密码不符则退出
$query = 'select * from (
select id,classid,titleurl,filename,title,newstime,titlepic from phome_ecms_muban where newstime union
select id,classid,titleurl,filename,title,newstime,titlepic from phome_ecms_chajian where newstime union
select id,classid,titleurl,filename,title,newstime,titlepic from phome_ecms_download where newstime union
select id,classid,titleurl,filename,title,newstime,titlepic from phome_ecms_ruanjian where newstime union
select id,classid,titleurl,filename,title,newstime,titlepic from phome_ecms_article where newstime) a order
by newstime desc limit 10';//我这里取的是最新10条信息,因为我推送的是快速收录,目前一天只能推送10条。
$sql=$empire->query($query);
while($r=$empire->fetch($sql)){
$newstime = date('Y-m-d',$r['newstime']);
$titleurl=sys_ReturnBqTitleLink($r);
$urls[]= "https://www.51yma.cn".$titleurl;
}
$api = 'http://data.zz.baidu.com/urls?site=https://www.51yma.cn&token=*********';//普通收录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);
echo $result;
?>

第二部,在宝塔面板的计划任务中新建一个计划任务,执行周期按照每日来设置,具体执行时间自行安排!

这样就OK 了,每日自动执行!
就等着百度来收录吧!!
懒人自己来下载吧!!!
https://pan.baidu.com/s/1G7VZKLvojijswzenFYllkA 提取码 i9g7