<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

织梦php主动推送完整实例(单篇推送版本)

时间:2020-12-15

打开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';
0
首页
案例
关于
联系