Use the Sina Weibo API's OAuth authentication to publish an instance of Weibo, Apioauth
Continue with the previous article "The main process of Sina Weibo OAuth authentication and storage", and now we use it to publish Weibo.
We have saved the Oauth_token and Oauth_secret of user Sina Weibo to
$_session[' Oauth_token ']= $result [' Oauth_token '];
$_session[' Oauth_secret ']= $result [' Oauth_secret '];
Inside, it's easy to do now. is to call the Sinaoauth class for publishing.
The code is as follows:
statuses/update$c = new Weiboclient (Wb_akey, wb_skey, $_session[' last_key ' [' Oauth_token '], $_ session[' Last_key ' [' Oauth_token_secret ']); $msg = $c->update ("Test published micro-blog"); 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"]);
So the simplest is OK.
The above mentioned is the whole content of this article, I hope you can like.
Please take a moment to share the article with your friends or leave a comment. We would be grateful for your support!
http://www.bkjia.com/PHPjc/974658.html www.bkjia.com true http://www.bkjia.com/PHPjc/974658.html techarticle using the Sina Weibo API's OAuth authentication to publish a microblog instance, Apioauth continues with the previous article "Sina Weibo OAuth authentication and storage of the main process details", now we use it to publish micro ...