后台系统参数新建字段
上海龙凤419 cfg_bdtoken:百度接口
cfg_bdhost:推送域名
修改相关PHP文件
上海龙凤419 打开/dede/article_add.php
找到
$artUrl = MakeArt($arcID,true,true,$isremote);
if($artUrl=='')
{
上海龙凤419 $artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
在下面加入
else{
$urls[]='http://'.$cfg_bdhost.''.$artUrl;//如果网站开启了SSL,请把http改成https
$api = $cfg_bdtoken;
$ch = curl_init();
上海龙凤419 $options =array(
上海龙凤419 CURLOPT_URL => $api,
上海龙凤419 CURLOPT_POST => true,
上海龙凤419 CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode(" ", $urls),
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
);
curl_setopt_array($ch, $options);
上海龙凤419 $result = curl_exec($ch);
}
继续找到
上海龙凤419 <a href='catalog_do.php?cid=$typeid&dopost=listArchives'><u>已发布文章管理</u></a>
在下面加入
<a href=''><u>百度提交返回".$result."</u></a>
上海龙凤419
保存。上海龙凤419 继续操作,打开/dede/article_edit.php
找到
$artUrl = MakeArt($id,true,true,$isremote);
if($artUrl=='')
{
$artUrl = $cfg_phpurl."/view.php?aid=$id";
}
在下面加入
else{
$urls[]='http://'.$cfg_bdhost.''.$artUrl;//如果网站开启了SSL,请把http改成https
$api = $cfg_bdtoken;
$ch = curl_init();
$options =array(
CURLOPT_URL => $api,
上海龙凤419 CURLOPT_POST => true,
上海龙凤419 CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode(" ", $urls),
上海龙凤419 CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
);
上海龙凤419 curl_setopt_array($ch, $options);
$result = curl_exec($ch);
}
继续找到
上海龙凤419 <a href='catalog_do.php?cid=$typeid&dopost=listArchives'><u>管理文章</u></a>
在下面加入
<a href=''><u>百度提交返回".$result."</u></a>
完成,发布文章和更新文章都实现百度主动推送了。
相关文章: