Interface calling address: http://ping.baidu.com/sitemap?site=www.xxx.com&resource_name=sitemap&access_token=XXXXXXX Parameter site is a string of sites verified on the webmaster platform, such as www.example.com resource_name You The name of the data that is allowed to be pushed, such as RDF_BBS_Thread or sitemap access_token is a string. The access key for push applied on the webmaster platform
This method is only applicable to sites that have opened Baidu sitemap permissions. When the page is updated, you can ping directly. To Baidu. Can be viewed in Baidu backend
Feedback code
200 No usage error, need to further observe whether the returned content is correct 400 Required parameters are not provided 405 Unsupported request method, we only support POST method to submit data 411 HTTP The Content-Length field is missing in the header 413 The pushed data is too large and exceeds the 10MB limit 422 The length of the Content-Length declaration in the HTTP header is inconsistent with the length of the actual data sent 500 Webmaster Platform server internal error
www. code provided by appleshu.com apple novel network
- function tobaidu($url){
- $ntime=time();
- $now = date('Y-m-d',$ntime);
- $data ='';
- $data .=' ';
- $data .=' ';
- $data .=' ';
- $data .=' '.$now.'';
- $data .=' ';
- $data .=' 0.8';
- $data .=' ';
- $data .=' ';
-
- $pingurl="http://ping.baidu.com/sitemap?site=www.xxx.com&resource_name=sitemap&access_token=XXXXXXX";//Your interface address
- $curl = curl_init(); // Start A CURL session
- curl_setopt($curl, CURLOPT_URL, $pingurl); // The address to be accessed
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // Check the source of the authentication certificate
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1) ; // Check whether the SSL encryption algorithm exists from the certificate
- curl_setopt($curl, CURLOPT_USERAGENT, "curl/7.12.1"); // Simulate the browser used by the user
- curl_setopt($curl, CURLOPT_COOKIE, $cookie);
- curl_setopt($curl, CURLOPT_REFERER,"");
- curl_setopt($curl, CURLOPT_POST, 1); // Send a regular Post request
- curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post submitted data packet
- curl_setopt($curl, CURLOPT_TIMEOUT, 30); // Set timeout limit to prevent infinite loop
- curl_setopt($curl, CURLOPT_HEADER, 0); // Display the content of the returned Header area
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // The obtained information is returned in the form of a file stream
- $tmpInfo = curl_exec($curl); //Perform the operation
- if (curl_errno($curl)) {
- echo 'Errno'.curl_error($curl);//Catch exceptions
- }
- curl_close($curl); // Close CURL session
- return $tmpInfo; // Return data
- }
-
- $tt= tobaidu("http://www.appleshu.com/");
Copy Code
|