最近玩了下熊掌号,顺便写了下他的推送api方法,其实推送方法和织梦发布文章后推送给百度主动推送和更新数据此文一样,少了后台调用接口
找到后面文件夹下的article_add.php。
找到
$artUrl = MakeArt($arcID,true,true,$isremote); if($artUrl=='') { $artUrl = $cfg_phpurl."/view.php?aid=$arcID"; }
在他下面加入
else{ $urls = array( 'http://mip.xhcss.com'.$artUrl.'', ); //下面部分用你自己的,上面固定连接改成你的 $api = 'http://data.zz.baidu.com/urls?appid=11111&token=11&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); //echo不要 }
下面
<a href='catalog_do.php?cid=$typeid&dopost=listArchives'><u>已发布文章管理</u></a>
后面加入
<a href=''><u>百度提交返回".$result."</u></a>
好了就这样就行了!
后面发布文章后就可以看见是否推送成功,我的推送了百度电脑和mip与熊掌号,如果你只加了熊掌号就会显示最后一个成功。 要加3个可以在本站看见教程