For help, PHP automatically ping Baidu's then ....
Little brother has a PHP station, the program did not automatically ping Baidu rss function, but I want to add one, so from the Internet to find the paragraph code as follows:
PHP Code
weblogupdates.extendedping
$url
$url
"; $res = PostURL (' http://ping.baidu.com/ping/rpc2′, $baiduXML);? >
And then.... No, then ...
Want to ask you how big, how can finally realize this RSS auto ping Baidu? For detailed steps, the younger brother is PHP rookie!
------Solution--------------------
PHP Code
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;} $url = "; Don't know what this value is $baiduxml = "
weblogupdates.extendedping
$url
$url
"Echo $res = PostURL (' http://ping.baidu.com/ping/RPC2 ', $baiduXML);