3 Line Java Code implementation Baidu Webmaster initiative push 12

Source: Internet
Author: User
Tags http post

Introduced

When the site added a page, at this time this page is not able to be immediately included in Baidu, if you want to be the fastest speed Baidu is included in the Baidu Webmaster tools can be used to submit the link to the initiative to Baidu, let Baidu included the page.

This article demonstrates the active push of Java using native HTTP post for linking

Code
String url="http://data.zz.baidu.com/urls?site=wenhaofan.com&token=kZ4mRWVQGEsoJvbz";Kv headers=Kv.by("User-Agent", "curl/7.12.1 ").set("Host", "data.zz.baidu.com").set("Content-Type", "text/plain").set("Content-Length", "83");String result=HttpKit.post(url, "http://wenhaofan.com/article/20180618180327\nhttp://wenhaofan.com/article/fast-reboot-tomcat",headers);System.out.println(result);


URL for Baidu Webmaster Management in the link submission page provided in the push interface of the interface call address

Headers setting the POST request request header

The second parameter in the Httkit.post () method is the URL of a Web page that needs to be pushed, with multiple URLs separated by \ n

One of the Kv,httpkit tools can be downloaded below click

Resources download

Httpkit class (Click to download)

KV Tool Class (click to download)


3 Line Java Code implementation Baidu Webmaster initiative push 12

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.