class OAuth (View source)

The OAuth extension provides a simple interface to interact with data providers using the OAuth HTTP specification to protect private resources.

Properties

bool $debug
bool $sslChecks
array $debugInfo

Methods

__construct(string $consumer_key, string $consumer_secret, string $signature_method = OAUTH_SIG_METHOD_HMACSHA1, int $auth_type = OAUTH_AUTH_TYPE_AUTHORIZATION)

Create a new OAuth object

bool
disableDebug()

Turn off verbose debugging

void
disableRedirects()

Turn off redirects

bool
disableSSLChecks()

Turn off SSL checks

bool
enableDebug()

Turn on verbose debugging

bool
enableRedirects()

Turn on redirects

bool
enableSSLChecks()

Turn on SSL checks

void
setTimeout(int $timeout)

Set the timeout

mixed
fetch(string $protected_resource_url, array $extra_parameters = [], string $http_method = null, array $http_headers = [])

Fetch an OAuth-protected resource

array
getAccessToken(string $access_token_url, string $auth_session_handle = null, string $verifier_token = null)

Fetch an access token

array
getCAPath()

Get CA information

string
getLastResponse()

Get the last response

string|false
getLastResponseHeaders()

Get headers for last response

array
getLastResponseInfo()

Get HTTP information about the last response

string|false
getRequestHeader(string $http_method, string $url, mixed $extra_parameters = '')

Generate OAuth header string signature

array
getRequestToken(string $request_token_url, string $callback_url = null, string $http_method = 'GET')

Fetch a request token

bool
setAuthType(int $auth_type)

Set authorization type

mixed
setCAPath(string $ca_path = null, string $ca_info = null)

Set CA path and info

mixed
setNonce(string $nonce)

Set the nonce for subsequent requests

void
setRequestEngine(int $reqengine)

No description

mixed
setRSACertificate(string $cert)

Set the RSA certificate

mixed
setTimestamp(string $timestamp)

Set the timestamp

bool
setToken(string $token, string $token_secret)

Set the token and secret

bool
setVersion(string $version)

Set the OAuth version

Details

__construct(string $consumer_key, string $consumer_secret, string $signature_method = OAUTH_SIG_METHOD_HMACSHA1, int $auth_type = OAUTH_AUTH_TYPE_AUTHORIZATION)

Create a new OAuth object

Parameters

string $consumer_key
string $consumer_secret
string $signature_method
int $auth_type

Exceptions

OAuthException

bool disableDebug()

Turn off verbose debugging

Return Value

bool

void disableRedirects()

Turn off redirects

Return Value

void

bool disableSSLChecks()

Turn off SSL checks

Return Value

bool

bool enableDebug()

Turn on verbose debugging

Return Value

bool

bool enableRedirects()

Turn on redirects

Return Value

bool

bool enableSSLChecks()

Turn on SSL checks

Return Value

bool

void setTimeout(int $timeout)

Set the timeout

Parameters

int $timeout

Time in milliseconds

Return Value

void

mixed fetch(string $protected_resource_url, array $extra_parameters = [], string $http_method = null, array $http_headers = [])

Fetch an OAuth-protected resource

Parameters

string $protected_resource_url
array $extra_parameters
string $http_method
array $http_headers

Return Value

mixed

Exceptions

OAuthException

array getAccessToken(string $access_token_url, string $auth_session_handle = null, string $verifier_token = null)

Fetch an access token

Parameters

string $access_token_url
string $auth_session_handle
string $verifier_token

Return Value

array

Exceptions

OAuthException

array getCAPath()

Get CA information

Return Value

array

string getLastResponse()

Get the last response

Return Value

string

string|false getLastResponseHeaders()

Get headers for last response

Return Value

string|false

array getLastResponseInfo()

Get HTTP information about the last response

Return Value

array

string|false getRequestHeader(string $http_method, string $url, mixed $extra_parameters = '')

Generate OAuth header string signature

Parameters

string $http_method
string $url
mixed $extra_parameters

Return Value

string|false

array getRequestToken(string $request_token_url, string $callback_url = null, string $http_method = 'GET')

Fetch a request token

Parameters

string $request_token_url
string $callback_url
string $http_method

Return Value

array

Exceptions

OAuthException

bool setAuthType(int $auth_type)

Set authorization type

Parameters

int $auth_type

Return Value

bool

mixed setCAPath(string $ca_path = null, string $ca_info = null)

Set CA path and info

Parameters

string $ca_path
string $ca_info

Return Value

mixed

mixed setNonce(string $nonce)

Set the nonce for subsequent requests

Parameters

string $nonce

Return Value

mixed

void setRequestEngine(int $reqengine)

No description

Parameters

int $reqengine

Return Value

void

mixed setRSACertificate(string $cert)

Set the RSA certificate

Parameters

string $cert

Return Value

mixed

mixed setTimestamp(string $timestamp)

Set the timestamp

Parameters

string $timestamp

Return Value

mixed

bool setToken(string $token, string $token_secret)

Set the token and secret

Parameters

string $token
string $token_secret

Return Value

bool

bool setVersion(string $version)

Set the OAuth version

Parameters

string $version

Return Value

bool