Interface calling address: http://ping.baidu.com/sitemap?site=www.xxx.com&resource_name=sitemap&access_token=XXXXXXX
Parameter
site is string The site 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 the string access key for push applied on the webmaster platform
This method is only applicable to sites that have opened Baidu sitemap permissions. You can ping directly when the page is updated. 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 declared by Content-Length in the HTTP header is inconsistent with the length of the actual data sent
500 Webmaster platform server internal error
function tobaidu($url){ $ntime=time(); $now = date('Y-m-d',$ntime); $data ='<?xml version="1.0" encoding="UTF-8"?>'; $data .=' <urlset>'; $data .=' <url>'; $data .=' <loc><![CDATA['.$url.']]></loc>'; $data .=' <lastmod>'.$now.'</lastmod>'; $data .=' <changefreq>daily</changefreq>'; $data .=' <priority>0.8</priority>'; $data .=' </url>'; $data .=' </urlset>'; $pingurl="http://ping.baidu.com/sitemap?site=www.xxx.com&resource_name=sitemap&access_token=XXXXXXX";//你的接口地址 $curl = curl_init(); // 啟動一個CURL會話 curl_setopt($curl, CURLOPT_URL, $pingurl); // 要訪問的地址 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 對認(rèn)證證書來源的檢查 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1); // 從證書中檢查SSL加密算法是否存在 curl_setopt($curl, CURLOPT_USERAGENT, "curl/7.12.1"); // 模擬用戶使用的瀏覽器 curl_setopt($curl, CURLOPT_COOKIE, $cookie); curl_setopt($curl, CURLOPT_REFERER,""); curl_setopt($curl, CURLOPT_POST, 1); // 發(fā)送一個常規(guī)的Post請求 curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的數(shù)據(jù)包 curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 設(shè)置超時限制防止死循環(huán) curl_setopt($curl, CURLOPT_HEADER, 0); // 顯示返回的Header區(qū)域內(nèi)容 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 獲取的信息以文件流的形式返回 $tmpInfo = curl_exec($curl); // 執(zhí)行操作 if (curl_errno($curl)) { echo 'Errno'.curl_error($curl);//捕抓異常 } curl_close($curl); // 關(guān)閉CURL會話 return $tmpInfo; // 返回數(shù)據(jù) } $tt= tobaidu("http://www.appleshu.com/");

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
