Fast recording of Google /Baidu Ping service with PHP

time:18-04-22 forum:PHP tools and code
  https://my.oschina.net/afengzxf/blog/1634413

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 / >)

prev:Students of mountain craft and creative ... next:Do you envy me 8 kinds of life? There ar...
post comment
Notice



approved   He was a high student at Yale, but h...   Eight couples in Ji'nan join hands i...   India actor Amirkhan loses weight vi...   The head of Tsinghua elementary scho...   The latest regulations on maternity ...
rand   PHP reads the MYSQL contents into tw...   How do you grab and analyze the page...   Processing techniques for PHP passin...   Four ways of transferring parameters...   The difference of PHP array traversa...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com