打開article_add.php文件,查找如下代碼
-------
if($artUrl=='')
{
$artUrl = $cfg_phpurl."/view.php?aid=$id";
}
ClearMyAddon($id, $title);
------
中間添加代碼如下:
------
if($artUrl=='')
{
$artUrl = $cfg_phpurl."/view.php?aid=$id";
}
//推送開始
if(strstr($artUrl,'.html')!='')//判斷是否獲取到靜態(tài)地址,取得靜態(tài)連接就推送百度
{
preg_match('@^(?:ht刪除tp://)?([^/]+)@i', $artUrl, $matches);//判斷子域名并自動添加到API中
$host = $matches[1];
$urls = array(
$artUrl,
);
$api = 'ht刪除tp點//data點zz點baidu點com/urls?site='.$host.'&token=你的APIkey';
$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;
}
//推送結(jié)束
ClearMyAddon($id, $title);
-------
如果未啟用絕對路徑和子域名的,按以下改:
刪除這兩行
preg_match('@^(?:ht刪除tp://)?([^/]+)@i', $artUrl, $matches);//判斷子域名并自動添加到API中
$host = $matches[1];
修改這行
$api = 'ht刪除tp點//data點zz點baidu點com/urls?site='.$host.'&token=你的APIkey';
為
$api = 'ht刪除tp點//data點zz點baidu點com/urls?site=www.你的域名.com&token=你的APIkey';