public static function OAuthRequest::from_request in OAuth 1.0 6
Same name and namespace in other branches
- 6.3 lib/OAuth.php \OAuthRequest::from_request()
- 7.3 lib/OAuth.php \OAuthRequest::from_request()
attempt to build up a request from what was passed to the server
3 calls to OAuthRequest::from_request()
- oauth_access_token in ./
oauth.module - oauth_grant_access_submit in ./
oauth.module - Asks users for granting proper access/deny permissions for different services
- oauth_request_token in ./
oauth.module - Generate a request token from the request
File
- ./
OAuth.php, line 182
Class
Code
public static function from_request($http_method = NULL, $http_url = NULL, $parameters = NULL) {
/*{{{*/
$scheme = !isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on" ? 'http' : 'https';
@$http_url or $http_url = $scheme . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
@$http_method or $http_method = $_SERVER['REQUEST_METHOD'];
$request_headers = OAuthRequest::get_headers();
// let the library user override things however they'd like, if they know
// which parameters to use then go for it, for example XMLRPC might want to
// do this
if ($parameters) {
$req = new OAuthRequest($http_method, $http_url, $parameters);
}
else {
if (@substr($request_headers['Authorization'], 0, 5) == "OAuth") {
$header_parameters = OAuthRequest::split_header($request_headers['Authorization']);
if ($http_method == "GET") {
$req_parameters = $_GET;
}
else {
if ($http_method = "POST") {
$req_parameters = $_POST;
}
}
$parameters = array_merge($header_parameters, $req_parameters);
$req = new OAuthRequest($http_method, $http_url, $parameters);
}
else {
if ($http_method == "GET") {
$req = new OAuthRequest($http_method, $http_url, $_GET);
}
else {
if ($http_method == "POST") {
$req = new OAuthRequest($http_method, $http_url, $_POST);
}
}
}
}
return $req;
}