This article describes how to use Sina Weibo API OAuth to publish Weibo instances, for more information about the OAuth authentication and storage process of Sina Weibo, see the previous article. Now we will use it to publish Weibo.
We have saved the oauth_token and oauth_secret of Sina Weibo
$ _ SESSION ['oss _ token'] = $ result ['oss _ token'];
$ _ SESSION ['oss _ secret'] = $ result ['oss _ secret'];
In this example, we need to call the sinaOauth class for release ..
The Code is as follows:
// Statuses/update $ c = new WeiboClient (WB_AKEY, WB_SKEY, $ _ SESSION ['last _ key'] ['oss _ token'], $ _ SESSION ['last _ key'] ['oss _ token_secret ']); $ msg = $ c-> update ("test posting Weibo "); if ($ msg = false | $ msg = null) {echo "Error occured"; return false ;} if (isset ($ msg ['error _ Code']) & isset ($ msg ['error']) {echo ('error _ code :'. $ msg ['error _ Code']. '; Error :'. $ msg ['error']); return false;} echo ($ msg ['id']. ":". iconv ('utf-8', 'gb2312', $ msg ['text']). "-". $ msg ["created_at"]);
In this way, the simplest thing is OK ····
The above is all the content of this article. I hope you will like it.
Please take a moment to share your article with your friends or leave a comment. Thank you for your support!