Fast recording of Google /Baidu Ping service with PHP
friends who have played WORDPRESS should know the Ping Service. The engine sends instructions and asks them to come. They do not have to wait for them to collect them. Direct the code, it's very simple.
Google explains documents: https://www.google.com/intl/zh-CN/help/blogsearch/pinging_API.html
baidu documents: http://help.baidu.com/question? Prod_en=master.amp; class=478.amp; id=3046
[code]/**
- -- - -- - -- - -- -- - --- ------------
notify the search engine to catch up with the latest releases. Second, not dream
* currently only support Google and Baidu
------------------------------------------------------------------------------
*/
class Ping {
public $method. ) {
$this-.gt; method =.Quot;
.Lt; XML version=.quot; 1.0.quot; encoding=.quot; UTF-8.quot;.Gt Lt; /param.gt;
.Lt; param.gt;.Lt; value.gt; {$site_url}.lt; /value.gt;.Lt; /param.gt;
; Br / > return $this-.gt; method;
}
public function _post ($url, $postvar); -8.quot;.Quot;
.Quot; Accept: text/xml.quot;
.Quot; Content-length:.Quot; strlen ($postvar) / >;
curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postvar);
$res =. CK = $this-.gt; _post ('http://blogsearch.google.com/ping/RPC2', $this-.gt; method);
return strpos ($this-.gt; callback,.Quot;.Quot) P://ping.baidu.com/ping/RPC2', $this-.gt; method);
return strpos ($this-.gt; callback,.Quot;.Lt; int.gt; 0.lt; return / >)