PHP 클래스 OAuthClient

파일 보기 프로젝트 열기: baserproject/basercms 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( $consumerKey, $consumerSecret = '' )
get ( $accessTokenKey, $accessTokenSecret, $url, array $getData = [] ) Call API with a GET request. Returns either false on failure or an HttpResponse object.
getAccessToken ( $accessTokenURL, $requestToken, $httpMethod = 'POST', array $parameters = [] )
getFullResponse ( ) Returns an HttpResponse object for the previous request, or null, if there was no request.
getRequestToken ( $requestTokenURL, $callback = 'oob', $httpMethod = 'POST', array $parameters = [] )
post ( $accessTokenKey, $accessTokenSecret, $url, array $postData = [] ) Call API with a POST request. Returns either false on failure or an HttpResponse object.
postMultipartFormData ( $accessTokenKey, $accessTokenSecret, $url, array $paths, array $postData = [] ) Call API with a POST request, the content type set to multipart/form-data.

보호된 메소드들

메소드 설명
createOAuthToken ( array $response )

비공개 메소드들

메소드 설명
createConsumer ( )
createRequest ( $httpMethod, $url, $token, array $parameters )
doGet ( $url )
doPost ( $url, $data )
doPostMultipartFormData ( $url, $authorization, $paths, $data )
getToken ( $request )

메소드 상세

__construct() 공개 메소드

public __construct ( $consumerKey, $consumerSecret = '' )

createOAuthToken() 보호된 메소드

protected createOAuthToken ( array $response )
$response array

get() 공개 메소드

Call API with a GET request. Returns either false on failure or an HttpResponse object.
public get ( $accessTokenKey, $accessTokenSecret, $url, array $getData = [] )
$getData array

getAccessToken() 공개 메소드

public getAccessToken ( $accessTokenURL, $requestToken, $httpMethod = 'POST', array $parameters = [] )
$parameters array

getFullResponse() 공개 메소드

Returns an HttpResponse object for the previous request, or null, if there was no request.
public getFullResponse ( )

getRequestToken() 공개 메소드

public getRequestToken ( $requestTokenURL, $callback = 'oob', $httpMethod = 'POST', array $parameters = [] )
$requestTokenURL
$callback An absolute URL to which the server will redirect the resource owner back when the Resource Owner Authorization step is completed. If the client is unable to receive callbacks or a callback URL has been established via other means, the parameter value MUST be set to oob (case sensitive), to indicate an out-of-band configuration. Section 2.1 from http://tools.ietf.org/html/rfc5849
$httpMethod 'POST' or 'GET'
$parameters array

post() 공개 메소드

Call API with a POST request. Returns either false on failure or an HttpResponse object.
public post ( $accessTokenKey, $accessTokenSecret, $url, array $postData = [] )
$postData array

postMultipartFormData() 공개 메소드

This is, for example, necessary for Twitter's update_with_media API method (https://dev.twitter.com/docs/api/1/post/statuses/update_with_media) $paths a key-value array, example: array('media[]' => '/home/dho/avatar.png') Returns either false on failure or an HttpResponse object.
public postMultipartFormData ( $accessTokenKey, $accessTokenSecret, $url, array $paths, array $postData = [] )
$paths array
$postData array