打开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')!='')//判断是否获取到静态地址,取得静态连接就推送百度
- {
- 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;
- }
- //推送结束
- 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';