Baidu Ping service php cashing and Google Ping service

Source: Internet
Author: User
Baidu Ping service PHP implementation and Google Ping service
Baidu Ping Service PHP implementation:
$baiduXML = <<
 <>
  
  
  
   
   
    
    Weblogupdates.extendedping
   
   
   
   
    
    Small Orange Lamp Classified information network 
    
    
    
     
     
     
     
    
    
    
    
    
    
     
     
      
      http://www.xiaojudeng.com
     
     
    
    
    
    
    
    
     
     
      
      www.xiaojudeng.com
     
     
    
    
    
    
    
    
     
     
      
      Http://www.xiaojudeng.com/sitemaps.xml
     
     EOT;
    
    $res = PostURL (' http
   
   
  
  :// PING.BAIDU.COM/PING/RPC2 ', $baiduXML);//The following is the decision to return success (according to the interface description of Baidu ping) if (Strpos ($res, "
  
  
   
   0
  
  "))        echo" Ping succeeded ";    else        echo "Ping failed";
 
  


Google Ping Service Code:
$googleXML = <<
 <>
  
  
    
   
   
    
    Weblogupdates.extendedping
   
     
   
   
        
    Small Orange Lamp Classified information network 
          
    
    
    
            
    
           
    
    
     
     http://www.xiaojudeng.com
    
    /        
    http
          
    
    
    
            
    www.xiaojudeng.com
          
    
    
     
     http://www.xiaojudeng.com/sitemaps.xml
    
    END; $res = PostURL (' http://blogsearch.google.com/ping/RPC2 ', $googleXML);//      
   
   
  
   The following is the decision to return success (according to the interface description of Google ping) if (Strpos ($res, "
  
  
   
  0
  "))        echo "Ping succeeded";    else        echo "Ping failed";
 
  


The PostURL function 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;}

Reprinted from Http://www.js8.in/644.html
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.