Property | Type | Description | |
---|---|---|---|
$access_token | |||
$boundary | boundary of multipart | ||
$client_id | |||
$client_secret | |||
$connecttimeout | Set connect timeout. | ||
$debug | print the debug info | ||
$decode_json | Decode returned json data. | ||
$format | Respons format. | ||
$host | Set up the API root URL. | ||
$http_code | Contains the last HTTP status code returned. | ||
$http_info | Contains the last HTTP headers returned. | ||
$refresh_token | |||
$ssl_verifypeer | Verify SSL Cert. | ||
$timeout | Set timeout default. | ||
$url | Contains the last API call. | ||
$useragent | Set the useragnet. |
Method | Description | |
---|---|---|
__construct ( $client_id, $client_secret, $access_token = NULL, $refresh_token = NULL ) | construct WeiboOAuth object | |
accessTokenURL ( ) | ||
authorizeURL ( ) | ||
base64decode ( $str ) | ||
build_http_query_multi ( $params ) | ||
delete ( $url, $parameters = [] ) : mixed | DELTE wrapper for oAuthReqeust. | |
get ( $url, $parameters = [] ) : mixed | GET wrappwer for oAuthRequest. | |
getAccessToken ( string $type = 'code', array $keys ) : array | access_token接口 | |
getAuthorizeURL ( string $url, string $response_type = 'code', string $state = NULL, string $display = NULL ) : array | authorize接口 | |
getHeader ( $ch, $header ) : integer | Get the header info to store. | |
getTokenFromArray ( array $arr ) : array | 从数组中读取access_token和refresh_token 常用于从Session或Cookie中读取token,或通过Session/Cookie中是否存有token判断登录状态。 | |
getTokenFromJSSDK ( ) : array | 读取jssdk授权信息,用于和jssdk的同步登录 | |
http ( $url, $method, $postfields = NULL, $headers = [] ) : string | Make an HTTP request | |
oAuthRequest ( $url, $method, $parameters, $multi = false ) : string | Format and sign an OAuth / API request | |
parseSignedRequest ( string $signed_request ) : array | 解析 signed_request | |
post ( $url, $parameters = [], $multi = false ) : mixed | POST wreapper for oAuthRequest. |
public __construct ( $client_id, $client_secret, $access_token = NULL, $refresh_token = NULL ) |
public getAccessToken ( string $type = 'code', array $keys ) : array | ||
$type | string | 请求的类型,可以为:code, password, token |
$keys | array | 其他参数: - 当$type为code时: array('code'=>..., 'redirect_uri'=>...) - 当$type为password时: array('username'=>..., 'password'=>...) - 当$type为token时: array('refresh_token'=>...) |
return | array |
public getAuthorizeURL ( string $url, string $response_type = 'code', string $state = NULL, string $display = NULL ) : array | ||
$url | string | 授权后的回调地址,站外应用需与回调地址一致,站内应用需要填写canvas page的地址 |
$response_type | string | 支持的值包括 code 和token 默认值为code |
$state | string | 用于保持请求和回调的状态。在回调时,会在Query Parameter中回传该参数 |
$display | string | 授权页面类型 可选范围: - default 默认授权页面 - mobile 支持html5的手机 - popup 弹窗授权页 - wap1.2 wap1.2页面 - wap2.0 wap2.0页面 - js js-sdk 专用 授权页面是弹窗,返回结果为js-sdk回掉函数 - apponweibo 站内应用专用,站内应用不传display参数,并且response_type为token时,默认使用改display.授权后不会返回access_token,只是输出js刷新站内应用父框架 |
return | array |
public getTokenFromArray ( array $arr ) : array | ||
$arr | array | 存有access_token和secret_token的数组 |
return | array | 成功返回array('access_token'=>'value', 'refresh_token'=>'value'); 失败返回false |
public getTokenFromJSSDK ( ) : array | ||
return | array | 成功返回array('access_token'=>'value', 'refresh_token'=>'value'); 失败返回false |
public oAuthRequest ( $url, $method, $parameters, $multi = false ) : string | ||
return | string |
public parseSignedRequest ( string $signed_request ) : array | ||
$signed_request | string | 应用框架在加载iframe时会通过向Canvas URL post的参数signed_request |
return | array |