Baidu Webmaster tools to provide links to push the function, so that the majority of the webmaster more convenient to push their own links to Baidu, increase the inclusion of opportunities and shorten the collection time (of course, Baidu also said that you submitted a link, I do not necessarily included!). )
Baidu provides a number of ways, there are active push, automatic push, Sitemap push and so on. Today we have to say is the initiative to push, from the literal meaning can be clearly seen, the initiative to push, that is, the webmaster to push the link to Baidu. So how does it work? In fact, the principle is very simple, is to push the link post to Baidu designated address to be able to.
below we use C # to implement, the source code is as follows:
Push Link to Baidu Private string posturl (String data) { try {string url = "Http://data.zz.baidu.com/urls?site= Here Change your website domain name &token= here to your own token"; httpwebrequest request = (HttpWebRequest) httpwebrequest.create (URL); request. method = "POST"; request. useragent = "curl/7.12.1"; request. contenttype = "Text/plain"; request. Contentlength = data. length;//converts the argument to a byte array and writes it to the request in Stream stream = request. GetRequestStream (); byte[] byt = encoding.utf8.getbytes (data); stream. Write (Byt, 0, byt. Length); stream. Close ();//Get response httpwebresponse response = request. GetResponse () as HttpWebResponse;if (response. Statuscode == httpstatuscode.ok) { //Note that this is to be changed according to the website encoding format using ( Streamreader sr = new streamreader (response. GetResponseStream (), encoding.getencoding ("UTF-8 ")) {//return the request result STRING RESULT = SR. ReadToEnd (); response. Close (); return result; }}else{ //Connection Failed return null ;} } catch {return null; }}
Calling code:
PostURL ("You want to push the link address, such as http://www.itc8.com/detail/2016/0114/6475.html");
A successful push returns a JSON string in the following format
{"Remain:xxx", "Success": 0}, where xxx indicates how many links you can push again today. General new website words can only push 500 per day, note, push the repeated link is also to reduce the number of bars.
After the push is complete, you can see the push situation the day before.
Original address: HTTP://WWW.JIANFANGKK.COM/OTHER/201601/2
C # Implementation of Baidu Webmaster Tools link Active Submission function