PHP Class Abraham\TwitterOAuth\TwitterOAuth

Author: Abraham Williams ([email protected])
Inheritance: extends Abraham\TwitterOAuth\Config
Exibir arquivo Open project: abraham/twitteroauth Class Usage Examples

Public Methods

Method Description
__construct ( string $consumerKey, string $consumerSecret, string | null $oauthToken = null, string | null $oauthTokenSecret = null ) Constructor
delete ( string $path, array $parameters = [] ) : array | object Make DELETE requests to the API.
get ( string $path, array $parameters = [] ) : array | object Make GET requests to the API.
getLastApiPath ( ) : string | null
getLastBody ( ) : array | object | null
getLastHttpCode ( ) : integer
getLastXHeaders ( ) : array
oauth ( string $path, array $parameters = [] ) : array Make /oauth/* requests to the API.
oauth2 ( string $path, array $parameters = [] ) : array | object Make /oauth2/* requests to the API.
post ( string $path, array $parameters = [] ) : array | object Make POST requests to the API.
put ( string $path, array $parameters = [] ) : array | object Make PUT requests to the API.
resetLastResponse ( ) Resets the last response cache.
setOauthToken ( string $oauthToken, string $oauthTokenSecret )
upload ( string $path, array $parameters = [], boolean $chunked = false ) : array | object Upload media to upload.twitter.com.
url ( string $path, array $parameters ) : string Make URLs for user browser navigation.

Private Methods

Method Description
encodeAppAuthorization ( Abraham\TwitterOAuth\Consumer $consumer ) : string Encode application authorization header with base64.
http ( string $method, string $host, string $path, array $parameters ) : array | object
oAuthRequest ( string $url, string $method, array $parameters ) : string Format and sign an OAuth / API request
parseHeaders ( string $header ) : array Get the header info to store.
pharRunning ( ) : boolean Is the code running from a Phar module.
request ( string $url, string $method, string $authorization, array $postfields ) : string Make an HTTP request
uploadMediaChunked ( string $path, array $parameters ) : array | object Private method to upload media (chunked) to upload.twitter.com.
uploadMediaNotChunked ( string $path, array $parameters ) : array | object Private method to upload media (not chunked) to upload.twitter.com.

Method Details

__construct() public method

Constructor
public __construct ( string $consumerKey, string $consumerSecret, string | null $oauthToken = null, string | null $oauthTokenSecret = null )
$consumerKey string The Application Consumer Key
$consumerSecret string The Application Consumer Secret
$oauthToken string | null The Client Token (optional)
$oauthTokenSecret string | null The Client Token Secret (optional)

delete() public method

Make DELETE requests to the API.
public delete ( string $path, array $parameters = [] ) : array | object
$path string
$parameters array
return array | object

get() public method

Make GET requests to the API.
public get ( string $path, array $parameters = [] ) : array | object
$path string
$parameters array
return array | object

getLastApiPath() public method

public getLastApiPath ( ) : string | null
return string | null

getLastBody() public method

public getLastBody ( ) : array | object | null
return array | object | null

getLastHttpCode() public method

public getLastHttpCode ( ) : integer
return integer

getLastXHeaders() public method

public getLastXHeaders ( ) : array
return array

oauth() public method

Make /oauth/* requests to the API.
public oauth ( string $path, array $parameters = [] ) : array
$path string
$parameters array
return array

oauth2() public method

Make /oauth2/* requests to the API.
public oauth2 ( string $path, array $parameters = [] ) : array | object
$path string
$parameters array
return array | object

post() public method

Make POST requests to the API.
public post ( string $path, array $parameters = [] ) : array | object
$path string
$parameters array
return array | object

put() public method

Make PUT requests to the API.
public put ( string $path, array $parameters = [] ) : array | object
$path string
$parameters array
return array | object

resetLastResponse() public method

Resets the last response cache.
public resetLastResponse ( )

setOauthToken() public method

public setOauthToken ( string $oauthToken, string $oauthTokenSecret )
$oauthToken string
$oauthTokenSecret string

upload() public method

Upload media to upload.twitter.com.
public upload ( string $path, array $parameters = [], boolean $chunked = false ) : array | object
$path string
$parameters array
$chunked boolean
return array | object

url() public method

Make URLs for user browser navigation.
public url ( string $path, array $parameters ) : string
$path string
$parameters array
return string