Class to represent an OAuth request. More...
Public Member Functions | |
__construct ($http_method, $http_url, $parameters=null) | |
Class constructor. | |
set_parameter ($name, $value, $allow_duplicates=true) | |
Set a parameter. | |
get_parameter ($name) | |
Get a parameter. | |
get_parameters () | |
Get request parameters. | |
unset_parameter ($name) | |
Delete a parameter. | |
get_signable_parameters () | |
The request parameters, sorted and concatenated into a normalized string. | |
get_signature_base_string () | |
Returns the base string of this request. | |
get_normalized_http_method () | |
Just uppercases the http method. | |
get_normalized_http_url () | |
Parses the url and rebuilds it to be scheme://host/path. | |
to_url () | |
Builds a url usable for a GET request. | |
to_postdata () | |
Builds the data one would send in a POST request. | |
to_header ($realm=null) | |
Builds the Authorization: header. | |
__toString () | |
Convert object to a string. | |
sign_request ($signature_method, $consumer, $token) | |
Sign the request. | |
build_signature ($signature_method, $consumer, $token) | |
Build the signature. | |
Static Public Member Functions | |
static | from_request ($http_method=null, $http_url=null, $parameters=null) |
Attempt to build up a request from what was passed to the server. | |
static | from_consumer_and_token ($consumer, $token, $http_method, $http_url, $parameters=null) |
Pretty much a helper function to set up the request. | |
Data Fields | |
$base_string | |
Base string. | |
Static Public Attributes | |
static | $version = '1.0' |
Version. | |
static | $POST_INPUT = 'php://input' |
Access to POST data. | |
Protected Attributes | |
$parameters | |
Request parameters. | |
$http_method | |
HTTP method. | |
$http_url | |
HTTP URL. | |
Class to represent an OAuth request.
Definition at line 12 of file OAuthRequest.php.
__construct | ( | $http_method, | |
$http_url, | |||
$parameters = null |
|||
) |
Class constructor.
string | $http_method | HTTP method |
string | $http_url | HTTP URL |
array | null | $parameters | Request parameters |
Definition at line 66 of file OAuthRequest.php.
References OAuthRequest\$http_method, OAuthRequest\$http_url, OAuthRequest\$parameters, and OAuthUtil\parse_parameters().
__toString | ( | ) |
Convert object to a string.
Definition at line 373 of file OAuthRequest.php.
References OAuthRequest\to_url().
build_signature | ( | $signature_method, | |
$consumer, | |||
$token | |||
) |
Build the signature.
OAuthSignatureMethod | $signature_method | Signature method |
OAuthConsumer | $consumer | Consumer |
OAuthToken | null | $token | Token |
Definition at line 403 of file OAuthRequest.php.
Referenced by OAuthRequest\sign_request().
|
static |
Pretty much a helper function to set up the request.
OAuthConsumer | $consumer | Consumer |
OAuthToken | null | $token | Token |
string | $http_method | HTTP method |
string | $http_url | HTTP URL |
array | null | $parameters | Request parameters |
Definition at line 165 of file OAuthRequest.php.
References OAuthRequest\$http_method, OAuthRequest\$http_url, OAuthRequest\$parameters, and OAuthRequest\$version.
|
static |
Attempt to build up a request from what was passed to the server.
string | null | $http_method | HTTP method |
string | null | $http_url | HTTP URL |
array | null | $parameters | Request parameters |
Definition at line 84 of file OAuthRequest.php.
References OAuthRequest\$http_method, OAuthRequest\$http_url, OAuthRequest\$parameters, OAuthUtil\get_headers(), OAuthUtil\parse_parameters(), and OAuthUtil\split_header().
get_normalized_http_method | ( | ) |
Just uppercases the http method.
Definition at line 281 of file OAuthRequest.php.
Referenced by OAuthRequest\get_signature_base_string().
get_normalized_http_url | ( | ) |
Parses the url and rebuilds it to be scheme://host/path.
Definition at line 291 of file OAuthRequest.php.
Referenced by OAuthRequest\get_signature_base_string(), and OAuthRequest\to_url().
get_parameter | ( | $name | ) |
Get a parameter.
string | $name | Parameter name |
Definition at line 210 of file OAuthRequest.php.
get_parameters | ( | ) |
Get request parameters.
Definition at line 220 of file OAuthRequest.php.
References OAuthRequest\$parameters.
get_signable_parameters | ( | ) |
The request parameters, sorted and concatenated into a normalized string.
Definition at line 240 of file OAuthRequest.php.
References OAuthRequest\$parameters, and OAuthUtil\build_http_query().
Referenced by OAuthRequest\get_signature_base_string().
get_signature_base_string | ( | ) |
Returns the base string of this request.
The base string defined as the method, the url and the parameters (normalized), each urlencoded and then concatenated with &.
Definition at line 263 of file OAuthRequest.php.
References OAuthRequest\get_normalized_http_method(), OAuthRequest\get_normalized_http_url(), OAuthRequest\get_signable_parameters(), and OAuthUtil\urlencode_rfc3986().
set_parameter | ( | $name, | |
$value, | |||
$allow_duplicates = true |
|||
) |
Set a parameter.
string | $name | Parameter name |
string | $value | Parameter value |
bool | $allow_duplicates | True if duplicates are allowed |
Definition at line 187 of file OAuthRequest.php.
Referenced by OAuthRequest\sign_request().
sign_request | ( | $signature_method, | |
$consumer, | |||
$token | |||
) |
Sign the request.
OAuthSignatureMethod | $signature_method | Signature method |
OAuthConsumer | $consumer | Consumer |
OAuthToken | null | $token | Token |
Definition at line 385 of file OAuthRequest.php.
References OAuthRequest\build_signature(), and OAuthRequest\set_parameter().
to_header | ( | $realm = null | ) |
Builds the Authorization: header.
string | null | $realm | Realm |
OAuthException |
Definition at line 341 of file OAuthRequest.php.
References OAuthUtil\urlencode_rfc3986().
to_postdata | ( | ) |
Builds the data one would send in a POST request.
Definition at line 328 of file OAuthRequest.php.
References OAuthUtil\build_http_query().
Referenced by OAuthRequest\to_url().
to_url | ( | ) |
Builds a url usable for a GET request.
Definition at line 312 of file OAuthRequest.php.
References OAuthRequest\get_normalized_http_url(), and OAuthRequest\to_postdata().
Referenced by OAuthRequest\__toString().
unset_parameter | ( | $name | ) |
Delete a parameter.
string | $name | Parameter name |
Definition at line 230 of file OAuthRequest.php.
string $base_string |
Base string.
Definition at line 43 of file OAuthRequest.php.
|
protected |
HTTP method.
Definition at line 27 of file OAuthRequest.php.
Referenced by OAuthRequest\__construct(), OAuthRequest\from_consumer_and_token(), and OAuthRequest\from_request().
|
protected |
HTTP URL.
Definition at line 34 of file OAuthRequest.php.
Referenced by OAuthRequest\__construct(), OAuthRequest\from_consumer_and_token(), and OAuthRequest\from_request().
|
protected |
Request parameters.
Definition at line 20 of file OAuthRequest.php.
Referenced by OAuthRequest\__construct(), OAuthRequest\from_consumer_and_token(), OAuthRequest\from_request(), OAuthRequest\get_parameters(), and OAuthRequest\get_signable_parameters().
|
static |
Access to POST data.
Definition at line 57 of file OAuthRequest.php.
Referenced by System\getRawParameters(), and Util\logRequest().
|
static |
Version.
Definition at line 50 of file OAuthRequest.php.
Referenced by OAuthRequest\from_consumer_and_token().