\SaeTOAuthV2
新浪微博 OAuth 认证类(OAuth2)
授权机制说明请大家参考微博开放平台文档:
- Author: Elmer Zhang
Synopsis
class SaeTOAuthV2
{
- // members
- public $client_id;
- public $client_secret;
- public $access_token;
- public $refresh_token;
- public $http_code;
- public $url;
- public string $host = "https://api.weibo.com/2/";
- public integer $timeout = 30;
- public integer $connecttimeout = 30;
- public boolean $ssl_verifypeer = FALSE;
- public string $format = 'json';
- public boolean $decode_json = TRUE;
- public $http_info;
- public string $useragent = 'Sae T OAuth2 v0.1';
- public boolean $debug = FALSE;
- public static string $boundary = '';
- // methods
- public void accessTokenURL()
- public void authorizeURL()
- public void __construct()
- public array getAuthorizeURL()
- public array getAccessToken()
- public array parseSignedRequest()
- public void base64decode()
- public array getTokenFromJSSDK()
- public array getTokenFromArray()
- public mixed get()
- public mixed post()
- public mixed delete()
- public string oAuthRequest()
- public string http()
- public int getHeader()
- public static void build_http_query_multi()
Members
public
- $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.
Methods
public
- __construct() — construct WeiboOAuth object
- accessTokenURL()
- base64decode()
- build_http_query_multi()
- delete() — DELTE wrapper for oAuthReqeust.
- get() — GET wrappwer for oAuthRequest.
- getAccessToken() — access_token接口
- getAuthorizeURL() — authorize接口
- getHeader() — Get the header info to store.
- getTokenFromArray() — 从数组中读取access_token和refresh_token 常用于从Session或Cookie中读取token,或通过Session/Cookie中是否存有token判断登录状态。
- getTokenFromJSSDK() — 读取jssdk授权信息,用于和jssdk的同步登录
- http() — Make an HTTP request
- oAuthRequest() — Format and sign an OAuth / API request
- parseSignedRequest() — 解析 signed_request
- post() — POST wreapper for oAuthRequest.