帝国CMS百度自动提交URL和熊掌号修正办法,首要翻开ecmsinfo.php,增加以下代码

elseif($enews=="Post_Baidu_sitemap")//文章实时发送百度
{
$id=$_POST['id'];
$urls=$_POST['titleurl'];
ePostBaiduSitemap($id,$urls);
}
elseif($enews=="Post_realtime")//熊掌号新增内容接口
{
$id=$_POST['id'];
$urls=$_POST['titleurl'];
ePostrealtime($id,$urls);
}
elseif($enews=="Post_batch")//熊掌号前史内容接口
{
$id=$_POST['id'];
$urls=$_POST['titleurl'];
ePostrealtime($id,$urls);
}

翻开listinfo.php,增加提交按钮代码

<inputtype="submit"name="Submit101"value="百度URL自动提交"onClick="document.listform.enews.value='Post_Baidu_sitemap';document.listform.action='ecmsinfo.php';">
<inputtype="submit"name="Submit52"value="熊掌号新增内容"onClick="document.listform.enews.value='Post_realtime';document.listform.action='ecmsinfo.php';">
<inputtype="submit"name="Submit102"value="熊掌号前史内容"onClick="document.listform.enews.value='Post_batch';document.listform.action='ecmsinfo.php';">

翻开userfun.php,,增加提交函数

//发送给百度不时更新-------------------------------
functionePostBaiduSitemap($id,$_urls){
$site='https://www.pc07.com';//你的网站域名
$token='JG43q1HpKMWiNQ3D';//百度给的token
$countcount=count($id);
if(empty($count)){
printerror("未挑选信息ID","",1,0,1);
}
$urls=array();
for($i=0;$i<$count;$i++){
$id[$i]=(int)$id[$i];
if(array_key_exists($id[$i],$_urls)){
$urls[]=$_urls[$id[$i]];
}
}
$api="http://data.zz.baidu.com/urls?site=$site&token=$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);
$httpstat=curl_getinfo($ch,CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpstat==200){
$obj=json_decode($result);
printerror("今日剩下{$obj->remain}条,成功提交{$obj->success}条","",1,0,1);
}else{
printerror('推送失利',"",1,0,1);
}
}
//熊掌号新增内容接口
functionePostrealtime($id,$_urls){
$site='https://www.pc07.com';//你的网站域名
$token='HUuRZYgrlGLrVysh';//在查找资源渠道请求的推送用的准入密钥
$appid='1585197816243468';//您的熊掌号仅有辨认ID
$countcount=count($id);
if(empty($count)){
printerror("未挑选信息ID","",1,0,1);
}
$urls=array();
for($i=0;$i<$count;$i++){
$id[$i]=(int)$id[$i];
if(array_key_exists($id[$i],$_urls)){
$urls[]=$_urls[$id[$i]];
}
}
$api="http://data.zz.baidu.com/urls?appid=$appid&token=$token&type=realtime";
$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);
$httpstat=curl_getinfo($ch,CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpstat==200){
$obj=json_decode($result);
printerror("今日剩下{$obj->remain_realtime}条,成功提交{$obj->success_realtime}条","",1,0,1);
}else{
printerror('推送失利',"",1,0,1);
}
}
//熊掌号前史内容接口
functionePostbatch($id,$_urls){
$site='https://www.pc07.com';//你的网站域名
$token='HUuRZYgrlGLrVysh';//在查找资源渠道请求的推送用的准入密钥
$appid='1585197816243468';//您的熊掌号仅有辨认ID
$countcount=count($id);
if(empty($count)){
printerror("未挑选信息ID","",1,0,1);
}
$urls=array();
for($i=0;$i<$count;$i++){
$id[$i]=(int)$id[$i];
if(array_key_exists($id[$i],$_urls)){
$urls[]=$_urls[$id[$i]];
}
}
$api="http://data.zz.baidu.com/urls?appid=$appid&token=$token&type=batch";
$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);
$httpstat=curl_getinfo($ch,CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpstat==200){
$obj=json_decode($result);
printerror("今日剩下{$obj->remain_batch}条,成功提交{$obj->success_batch}条","",1,0,1);
}else{
printerror('推送失利',"",1,0,1);
}
}


声明:有的资源均来自网络转载,版权归原作者所有,如有侵犯到您的权益 请联系邮箱:123456@qq.com 我们将配合处理!

原文地址:帝国CMS百度主动提交URL和熊掌号修改方法发布于2022-07-17 10:59:39

相关推荐