In your application profile, find your key app key and app Secret. The second is to fill in the advanced information of the application of the authorization callback page and cancel the URL of the callback page, this can be your own local Web application URL or a valid URL on the network (can be http://www.baidu.com), note that this URL must not be at the end of the
All this information needs to be completed.
To Http://open.weibo.com/wiki/SDK the SDK needed, here is the Java example: you can download to the http://code.google.com/p/weibo4j/directly to the desired javasdk.
Download it and then pour it into your editing tool (Eclipse or MyEclipse) as shown:
Edit the Config.properties file and fill out the client_id =app Key Client_sercret=app_secret redirect_uri= The authorization callback URL that you just filled out in the application's advanced information. After you fill it out, OK to save it.
Then run the Oauth4code class under the Weibo4j.examples.oauth2 package below examples, where you will see http://********/?code=**************** in the URL of your callback page , the address information before the code is the URL of the callback you filled in, and the code behind is the key. You go to see the console information, is waiting for you to enter the code value, you only need to paste the code value to the console, press the Enter button, will show a lot of information about your microblog. Then note the value of the last line that appears access_token. With this access_token value, you can do all the things you want to do, including posting Sina Weibo and so on.
And look back at the UpdateStatus class below the example Weibo4j.examples.timeline bag.
String access_token= "2.001gkuccdjzabebcc4a40cc36fj6lb";
String statuses = "As long as a access_token, you are enough to play Sina Weibo, oyea~~";
Weibo Weibo = new Weibo ();
Weibo.settoken (Access_token);
Timeline TM = new Timeline ();
try {
Status status = TM. UpdateStatus (statuses);
Log.loginfo (Status.tostring ());
} catch (Weiboexception e) {
e.printstacktrace ();
}
}
Take a look and see if your Sina Weibo has posted the message ~~~~~