HTTP_OAuth
[ class tree: HTTP_OAuth ] [ index: HTTP_OAuth ] [ all elements ]

Class: HTTP_OAuth_Consumer

Source Location: /HTTP_OAuth-0.3.1/HTTP/OAuth/Consumer.php

Class Overview

HTTP_OAuth
   |
   --HTTP_OAuth_Consumer

HTTP_OAuth_Consumer


Author(s):

Copyright:

  • 2009 Jeff Hodsdon <jeffhodsdon@gmail.com>

Variables

Methods


Inherited Variables

Inherited Methods

Class: HTTP_OAuth

HTTP_OAuth::attachLog()
Attaches an instance of PEAR Log
HTTP_OAuth::buildHttpQuery()
Build HTTP Query
HTTP_OAuth::debug()
Log debug message
HTTP_OAuth::detachLog()
Detaches an instance of PEAR Log
HTTP_OAuth::err()
Log error message
HTTP_OAuth::info()
Log info message
HTTP_OAuth::log()
Log a message
HTTP_OAuth::urldecode()
URL Decode
HTTP_OAuth::urlencode()
URL Encode

Class Details

[line 66]
HTTP_OAuth_Consumer

Main consumer class that assists consumers in establishing OAuth creditials and making OAuth requests.

  1.  $consumer = new HTTP_OAuth_Consumer('key''secret');
  2.  $consumer->getRequestToken('http://example.com/oauth/request_token'$callback);
  3.  
  4.  // Store tokens
  5.  $_SESSION['token']        $consumer->getToken();
  6.  $_SESSION['token_secret'$consumer->getTokenSecret();
  7.  
  8.  $url $consumer->getAuthorizeUrl('http://example.com/oauth/authorize');
  9.  http_redirect($url)// function from pecl_http
  10.  
  11.  // When they come back via the $callback url
  12.  $consumer = new HTTP_OAuth_Consumer('key''secret'$_SESSION['token'],
  13.      $_SESSION['token_secret']);
  14.  $consumer->getAccessToken('http://example.com/oauth/access_token');
  15.  
  16.  // Store tokens
  17.  $_SESSION['token']        $consumer->getToken();
  18.  $_SESSION['token_secret'$consumer->getTokenSecret();
  19.  
  20.  // $response is an instance of HTTP_OAuth_Consumer_Response
  21.  $response $consumer->sendRequest('http://example.com/oauth/protected_resource');



[ Top ]


Class Variables

$consumerRequest =  null

[line 111]

Instance of HTTP_OAuth_Consumer_Request



[ Top ]

$key =  null

[line 74]

Consumer key
  • Var: Consumer key
  • Access: protected

Type:   string


[ Top ]

$lastRequest =  null

[line 118]

Instance of the last request made
  • Var: The last request made
  • Access: protected



[ Top ]

$lastResponse = null

[line 125]

Instance of the last response received
  • Access: protected



[ Top ]

$secret =  null

[line 81]

secret
  • Var: Consumer secret
  • Access: protected

Type:   string


[ Top ]

$signatureMethod =  'HMAC-SHA1'

[line 102]

Signature method
  • Var: Signature method
  • Access: protected

Type:   string


[ Top ]

$token =  null

[line 88]

Token
  • Var: Access/Request token
  • Access: protected

Type:   string


[ Top ]

$tokenSecret =  null

[line 95]

Token secret
  • Var: Access/Request token secret
  • Access: protected

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 137]

void __construct( string $key, string $secret, [string $token = null], [string $tokenSecret = null])

Construct
  • Access: public

Parameters:

string   $key     Consumer key
string   $secret     Consumer secret
string   $token     Access/Reqest token
string   $tokenSecret     Access/Reqest token secret

[ Top ]

accept   [line 369]

void accept( HTTP_OAuth_Consumer_Request $object)

Accepts a custom instance of HTTP_OAuth_Consumer_Request.

Parameters:

HTTP_OAuth_Consumer_Request   $object     Custom instance

[ Top ]

getAccessToken   [line 188]

array getAccessToken( string $url, [string $verifier = ''], [ $additional = array()], [string $method = 'POST'])

Get access token
  • Return: Token and token secret
  • Throws: HTTP_OAuth_Consumer_Exception_InvalidResponse Mising token/secret
  • Access: public

Parameters:

string   $url     Access token url
string   $verifier     OAuth verifier from the provider
array   $additional     Additional parameters to be in the request recommended in the spec.
string   $method     HTTP method to use for the request

[ Top ]

getAuthorizeUrl   [line 221]

string getAuthorizeUrl( string $url, [ $additional = array()])

Get authorize url
  • Return: Authorize url
  • Access: public

Parameters:

string   $url     Authorize url
array   $additional     Additional parameters for the auth url

[ Top ]

getKey   [line 268]

string getKey( )

Get key
  • Return: Consumer key
  • Access: public

[ Top ]

getLastRequest   [line 406]

null|HTTP_OAuth_Consumer_Request getLastRequest( )

Gets the last request
  • Return: Instance of the last request
  • See: self::sendRequest()
  • Access: public

[ Top ]

getLastResponse   [line 416]

HTTP_OAuth_Consumer_Response|null getLastResponse( )

Gets the most recent HTTP_OAuth_Consumer_Response object
  • Access: public

[ Top ]

getOAuthConsumerRequest   [line 392]

HTTP_OAuth_Consumer_Request getOAuthConsumerRequest( )

Gets instance of HTTP_OAuth_Consumer_Request

[ Top ]

getRequestToken   [line 157]

void getRequestToken( string $url, [string $callback = 'oob'], [ $additional = array()], [string $method = 'POST'])

Get request token
  • Throws: HTTP_OAuth_Consumer_Exception_InvalidResponse Missing token/secret
  • Access: public

Parameters:

string   $url     Request token url
string   $callback     Callback url
array   $additional     Additional parameters to be in the request recommended in the spec.
string   $method     HTTP method to use for the request

[ Top ]

getSecret   [line 278]

string getSecret( )

Get secret
  • Return: Consumer secret
  • Access: public

[ Top ]

getSecrets   [line 356]

array getSecrets( )

Get secrets
  • Return: Array possible secrets
  • Access: public

[ Top ]

getSignatureMethod   [line 334]

string getSignatureMethod( )

Get signature method
  • Return: Signature method
  • Access: public

[ Top ]

getToken   [line 288]

string getToken( )

Get token
  • Return: Token
  • Access: public

[ Top ]

getTokenSecret   [line 311]

string getTokenSecret( )

Get token secret
  • Return: Accessoken secret
  • Access: public

[ Top ]

sendRequest   [line 238]

HTTP_OAuth_Consumer_Response sendRequest( string $url, [ $additional = array()], [string $method = 'POST'])

Send request
  • Return: Instance of a response class
  • Access: public

Parameters:

string   $url     URL of the protected resource
array   $additional     Additional parameters
string   $method     HTTP method to use

[ Top ]

setSignatureMethod   [line 346]

void setSignatureMethod( string $method)

Set signature method
  • Access: public

Parameters:

string   $method     Signature method to use

[ Top ]

setToken   [line 300]

void setToken( string $token)

Set token
  • Access: public

Parameters:

string   $token     Request/Access token

[ Top ]

setTokenSecret   [line 323]

void setTokenSecret( string $secret)

Set token secret
  • Access: public

Parameters:

string   $secret     Token secret

[ Top ]


Documentation generated on Tue, 05 Nov 2013 20:30:04 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.