Ping百度自动提交网址

180it 2020-12-05 PM 1566℃ 0条
<?php
    function postUrl($url,$postvar){
        $ch = curl_init();
        $headers = array(
                "POST".$url."HTTP/1.0",
                "Content-type: text/xml;charset=\"utf-8\"",
                "Accept: text/xml",
                "Content-length:".strlen($postvar)
            );
        curl_setopt($ch,CURLOPT_URL,$url);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch,CURLOPT_POST,1);
        curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
        curl_setopt($ch,CURLOPT_POSTFIELDS,$postvar);
        $res = curl_exec($ch);
        curl_close($ch);
        return $res;
    }
    $baiduXML = "<?xml varsion=\"1.0\"> encoding=\"utf-8\"?>
                <methodCall>
                    <methodName>weblogUpdates.extendedPing</methodName>
                    <params>
                        <params><value>新浪新闻</value></params>
                        <params><value><string>http://wwww.wwww.com/index.php</string></value></params>
                        <params><value><string>http://wwww.wwww.com/index.php/html_1.html</string></value></params>
                        <params><value><string>http://wwww.wwww.com/index.php/html_2.html</string></value></params>
                        <params><value><string>http://wwww.wwww.com/index.php/html_3.html</string></value></params>
                    </params>
                </methodCall>
    ";
    $res = postUrl('http://ping.baidu.com/ping/RPC2',$baiduXML);

    var_dump($res);
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

Ping百度自动提交网址