JAVA Implementation of Sina Weibo API interface fun Sina Weibo (2)

Source: Internet
Author: User


Find the key app key and app secret in the basic information of your application. Second, fill in the authorization callback page and cancel the callback page URL in the application's advanced information, this can be your local web application URL or a valid URL on the Network (can be a http://www.baidu.com), note that this URL cannot end/

All these materials are required

To begin.

Download the package and import it to your editing tool (eclipse or myeclipse)


Edit the config. properties file and enter client_id = app key client_sercret = app_secret redirect_uri = the authorization callback URL you just entered in the application's advanced information. After filling in the information, OK to save.

Then run weibo4j under examples. examples. oauth4code class under the oau2package. Now you will see http: // *******/in the URL of your callback page ://********/? Code = *******************************, the address information before the code is the URL of the callback you fill in, and the subsequent code is the key. You can check the console information again, that is, wait for you to enter the code value. You only need to paste the code value to the console and press enter to display a lot of information about your Weibo. Write down the value of access_token in the last line. With the value of this access_token, you can do everything you want, including publishing Sina Weibo.

Let's look back at the updatestatus class under weibo4j. Examples. Timeline under the example package.

String access_token = "2.001gkuccdjzabebcc4a40cc36fj6lb"; string statuses = "as long as one access_token, you can play Sina Weibo, oyea ~~ "; Weibo = new Weibo (); Weibo. settoken (access_token); timeline TM = new timeline (); try {status = TM. updatestatus (statuses); log. loginfo (status. tostring ();} catch (weiboexception e) {e. printstacktrace ();}}

Take a look and see if your Sina Weibo has published this message ~~~~~ ·



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.