This article continues to talk about the problem of this ping service. First, we summarize and summarize the following information:
【1】Manual Ping service address:
Baidu (Baidu) address: http://ping.baidu.com/ping .html
Google address: http://blogsearch.google.com/ping
Feedsky address: http://ping.feedsky.com/ping.html
Qihoo( Qihoo) address: http://so.blog.qihoo.com/pingblog.html
IASK (爱 Ask) address: http://blog.iask.com/ping.php
【2】Automatic Ping Service Application Programming Interface (API):
Google: http://blogsearch.google.com/ping/RPC2
Feedburner: http://ping.feedburner.com
Feedsky ): http://www.feedsky.com/api/RPC2
Feedster: http://api.feedster.com/ping.php
IASK: http://blog.iask.com /RPC2
Qihoo (Qihoo): http://ping.blog.qikoo.com/rpc2.php
Fresh fruit: http://www.xianguo.com/xmlrpc/ping.php
Catch Shrimp: http://www.zhuaxia.com/rpc/server.php
Blogdigger: http://www.blogdigger.com/RPC2
blo.gs: http://ping.blo.gs/
ICEROCKEThttp://rpc.icerocket.com:10080/
Moreover: http://api.moreover.com/RPC2
Newsgator: http://rpc.newsgator.com/
Syndic8 : http://www.syndic8.com/xmlrpc.php
Weblogs: http://rpc.weblogs.com/RPC2
Weblogalot: http://ping.weblogalot.com/rpc.php
Among the ping services provided above, I have tried some that work well and some that don’t. It depends on the situation. You can test this yourself based on the network environment, etc., and the one that suits you is the best. There is no recommendation.
Okay, having said so much above, the following is the key point, that is, how to implement the ping service. WordPress can implement it through the background, what about the others? For example, what should I do if there is a blog program that does not have a ping service function? As far as Fenren knows, the easy-to-use wordpress in the blog system comes with a PING function. There is no doubt that the ASP-like Z-BLOG seems to be able to achieve this function through a plug-in. Other blogging systems? Others? There is nothing else, my only choice is wordpress, nothing else but the only one. Haha, no kidding. Let’s talk about the problem of using PHP to implement the ping service. This is for other websites or systems that do not support the ping function. You can develop an interface to implement it yourself. For example, the secondary development of DEDECMS can be used. Fenxun has been studying this project recently.
What needs to be said is that Baidu’s ping and Google’s submission formats are different. Let’s briefly talk about them and give an introduction to Baidu and Google respectively. The first introduction is Google (why not Baidu, OK? Don’t be so entangled , there will be...):
[*1] PHP implementation of Google's ping service
For a detailed introduction to RPC, you can go to Wikipedia, the standard of Google's ping service:
RPC endpoint: http ://blogsearch.google.com/ping/RPC2
Calling method name: weblogUpdates.extendedPing
Parameters: (should be sent in the same order as listed below)
Site name
Site URL
The URL of the page that needs to be checked for updates
The URL of the corresponding RSS, RDF or Atom seed
Optional: the category name (or tag) of the page content. You can specify multiple values, separated by '|' characters.
First, write a CURL function to POST Google's RPC endpoint:
Copy the code The code is as follows:
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;
}
After the main curl is written, the only thing left is to assemble the sent data according to Google’s XML-RPC standard. For detailed request examples, please refer to the official case, click here.
For example, my code is written like this:
Copy the code The code is as follows:
$googleXML = <<
weblogUpdates.extendedPing methodName>
PHP implementation method of Ping service, so that the website can be included quickly
http://s.jb51.net
http:/ /s.jb51.net/archives/47.html
http://s.jb51.net/feed< /value>
END;
$res = postUrl('http://blogsearch.google.com /ping/RPC2′, $googleXML);
//The following is the judgment of whether the return is successful or not (according to the interface description of Google ping)
if (strpos($res, "0echo "PING successful";
else
echo "PING failed";
OK, this can simply implement Google's PING service. You can modify the code to implement this function.
[*2] PHP implementation of Baidu’s ping service (this title is really DT)
Baidu’s ping service xml code is different from Google’s. Baidu always has its own characteristics:
Introduction Baidu Blog Ping Service, for a detailed introduction to Baidu Blog Ping Service, please go to: http://www.baidu.com/search/blogsearch_help.html#n7.
Baidu's ping service is also based on the XML-RPC standard protocol, but what is different from Google's ping service is that the XML format sent by Baidu's ping is different. We need to use string nodes to wrap the content.
For example:
Copy code The code is as follows:
weblogUpdates.extendedPing
< string>PHP implementation method of Ping service, allowing the website to be included quickly
http://s.jb51.net/
http:// s.jb51.net/archives/47.html
http:// s.jb51.net/feed
according to For the Google interface mentioned above, we only need to change the submitted xml content. Of course, the judgment returned by Baidu ping service is also different from Google's, and corresponding modifications can also be made.
The following is the PHP code:
Copy code The code is as follows:
$baiduXML = <<
weblogUpdates.extendedPing
PHP implementation method of Ping service, allowing the website to be included quickly
http:// s.jb51.net
http://s.jb51.net/archives/47.html< /string>
http://s.jb51.net/feed< /param>
EOT;
$res = postUrl('http://ping.baidu.com/ping/RPC2′, $baiduXML ; "PING successful";
else
echo "PING failed";
The above code can implement PHP's ping service. Okay, now I will provide you with a Baidu ping service code. Who makes it so unique?
Copy code
The code is as follows: function postUrl($url, $postvar)
{
$ch = curl_init();
$headers = array(
"POST ".$url." HTTP/1.0″,
"Content-type: text/xml; charset="gb2312"",
"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 = "
weblogUpdates.extendedPing
脚本之家
http://www.jb51.net
http://www.jb51.net/a/15222.html
http://www.jb51.net
";
$res = postUrl(‘http://ping.baidu.com/ping/RPC2′, $baiduXML);
if ( strpos($res, "
0") )
{
echo "PING成功";
}
else
{
echo "PING失败";
}
?>
此文很DT的让我浪费了N个草稿才写完,然后纷纭就发现需要搞个CODE的插件给WP装备上了。代码的问题真的很纠结,还有就是国人的WP主题没有支持分页的,这个让我很DT,说了半天,DT是啥?不知道……
http://www.bkjia.com/PHPjc/324871.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/324871.htmlTechArticle这篇文章继续说说这个ping服务的问题,首先归纳和总结以下资料: 【1】手动Ping服务地址: Baidu(百度)地址: http://ping.baidu.com/ping.html Goog...