使用新浪微博API的OAuth認證發布微博例項

2022-10-06 10:48:11 字數 858 閱讀 2161

繼續前面的文章《新浪微博oauth認證和儲存的主要過程詳解》,現在我們就使用它來發布微博。

我們已經將使用者新浪微博的oauth_token和oauth_secret儲存到

$_session['oauth_token']=$result['oauth_token'];

$_session['oauth_secret']=$result['oauth_secret'];

裡面,現在要做的就很簡單了就是呼叫sinaoauth的類進行發布。。

**如下:

//statuses/update

$bldjrc = new weiboclient( wb_akey ,

wb_skey ,

$_session['last_key']['oauth_token'] ,

$_session['last_key']['oauth_token_secret'] );

$msg = $c->update("測試發表微博");

if ($msg === false || $msg === null)

if (isset($msg['error_code']) && isset($msg['erwww.cppcns.comror']))程式設計客棧

echo($msg['id']." : ".iconv('utf-8', 'gb2312',

$msg['text'])." - ".$msg["created_at"]);

這樣最簡單的就ok了

請您花一點時間將文章分享給您的朋友或者留下評論。我們將會由衷感謝您的支援!

本文標題: 使用新浪微博api的oauth認證發布微博例項

本文位址: /wangluo/php/121561.html

新浪微博python下api的OAuth登陸

import webbrowser import weibopy from weibopy.auth import oauthhandler from weibopy.api import api self.u user def getauth self if len self.consumer k...

新浪微博 使用OAuth2 0呼叫API

coding cp936 python 2.7.10 xiaodeng 微博開放介面的呼叫,都需要獲取使用者的身份認證。目前微博開放平台使用者認證鑑權主要採用oauth2.0。使用oauth2.0呼叫api介面有2個方式 1 直接使用引數,傳遞引數名為access token url 2 在head...

新浪微博API的使用

在開發平台可以看見很多微博api 點開微博介面看見下面詳細介面 以獲取最新公共微博為例 獲取當前登入使用者及其所關注使用者的最新微博。parameters since id若指定此引數,則返回id比since id大的微博 即比since id時間晚的微博 預設為0 max id若指定此引數,則返回...