57 if (isset(
$_SERVER[
'QUERY_STRING'])) {
66 && isset($request_headers[
'Content-Type'])
67 && strstr($request_headers[
'Content-Type'],
'application/x-www-form-urlencoded')) {
74 if (isset($request_headers[
'Authorization']) && substr($request_headers[
'Authorization'], 0, 6) ==
'OAuth ') {
95 $defaults[
'oauth_token'] = $token->key;
105 if ($allow_duplicates && isset($this->parameters[
$name])) {
107 if (is_scalar($this->parameters[$name])) {
110 $this->parameters[
$name] =
array($this->parameters[$name]);
113 $this->parameters[
$name][] = $value;
115 $this->parameters[
$name] = $value;
120 return isset($this->parameters[
$name]) ? $this->parameters[
$name] : null;
128 unset($this->parameters[
$name]);
142 if (isset(
$params[
'oauth_signature'])) {
143 unset(
$params[
'oauth_signature']);
166 return implode(
'&', $parts);
174 return strtoupper($this->http_method);
183 $parts = parse_url($this->http_url);
185 $scheme = (isset($parts[
'scheme'])) ? $parts[
'scheme'] :
'http';
186 $port = (isset($parts[
'port'])) ? $parts[
'port'] : (($scheme ==
'https') ?
'443' :
'80');
187 $host = (isset($parts[
'host'])) ? strtolower($parts[
'host']) :
'';
188 $path = (isset($parts[
'path'])) ? $parts[
'path'] :
'';
190 if (($scheme ==
'https' && $port !=
'443')
191 || ($scheme ==
'http' && $port !=
'80')) {
192 $host =
"$host:$port";
195 return "$scheme://$host$path";
207 $out .=
'?'.$post_data;
231 $out =
'Authorization: OAuth';
234 foreach ($this->parameters as $k => $v) {
235 if (substr($k, 0, 5) !=
"oauth")
continue;
239 $out .= ($first) ?
' ' :
',';
259 "oauth_signature_method",
260 $signature_method->get_name(),
269 $signature = $signature_method->build_signature($this,
$consumer, $token);
287 return md5($mt . $rand);
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
build_signature($signature_method, $consumer, $token)
get_signature_base_string()
Returns the base string of this request.
get_normalized_http_url()
parses the url and rebuilds it to be scheme://host/path
static split_header($header, $only_allow_oauth_parameters=true)
Class to represent an OAuth Exception.
sign_request($signature_method, $consumer, $token)
static generate_timestamp()
util function: current timestamp
static build_http_query($params)
to_postdata()
builds the data one would send in a POST request
to_header($realm=null)
builds the Authorization: header
static from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=null)
pretty much a helper function to set up the request
static generate_nonce()
util function: current nonce
static urlencode_rfc3986($input)
static parse_parameters( $input)
static from_request($http_method=null, $http_url=null, $parameters=null)
attempt to build up a request from what was passed to the server
get_normalized_http_method()
just uppercases the http method
get_signable_parameters()
The request parameters, sorted and concatenated into a normalized string.
Create styles array
The data for the language used.
Class to represent an OAuth Request.
to_url()
builds a url usable for a GET request
__construct($http_method, $http_url, $parameters=null)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
set_parameter($name, $value, $allow_duplicates=true)