Quick indexing of GoogleBaiduPing service-php
Quick Google/Baidu Ping service
Http://www.phperzone.cn/portal.php? Mod = views & aid = 743
- /**
- + ------------------------------------------------------------------------------
- * Notify the search engine to capture the latest published content. Second receiving is not a dream
- * Currently, only Google and Baidu are supported.
- + ------------------------------------------------------------------------------
- */
- Class ping {
-
- Public $ method, $ callback;
-
- Public function method ($ site_name, $ site_url, $ update_url, $ update_rss ){
- $ This-> method ="
-
-
- WeblogUpdates. extendedPing
-
- {$ Site_name}
- {$ Site_url}
- {$ Update_url}
- {$ Update_rss}
-
- ";
- Return $ this-> method;
- }
-
- Public function _ post ($ 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;
- }
-
- Public function google (){
- $ This-> callback = $ this-> _ post ('http: // blogsearch.google.com/ping/RPC2', $ this-> method );
- Return strpos ($ this-> callback ," 0 ")? True: false;
- }
-
- Public function baidu (){
- $ This-> callback = $ this-> _ post ('http: // ping.baidu.com/ping/RPC2', $ this-> method );
- Return strpos ($ this-> callback ," 0 ")? True: false;
- }
-
- }
|