Zend Framework  1.12
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Zend_Oauth_Client Class Reference

Public Member Functions

 __construct ($oauthOptions, $uri=null, $config=null)
 Constructor; creates a new HTTP Client instance which itself is just a typical Zend_Http_Client subclass with some OAuth icing to assist in automating OAuth parameter generation, addition and cryptographioc signing of requests.
 
 setAdapter ($adapter)
 Load the connection adapter.
 
 setStreamingRequest ($value)
 Set the streamingRequest variable which controls whether we are sending the raw (already encoded) POST data from a stream source.
 
 getStreamingRequest ()
 Check whether the client is set to perform streaming requests.
 
 resetParameters ($clearAll=false)
 Clear all custom parameters we set.
 
 setRawDataStream ($data, $enctype=null)
 Set the raw (already encoded) POST data from a stream source.
 
 setMethod ($method=self::GET)
 Same as Zend_Http_Client::setMethod() except it also creates an Oauth specific reference to the method type.
 
 request ($method=null)
 Same as Zend_Http_Client::request() except just before the request is executed, we automatically append any necessary OAuth parameters and sign the request using the relevant signature method.
 
 prepareOauth ()
 Performs OAuth preparation on the request before sending.
 
 __call ($method, array $args)
 Simple Proxy to the current Zend_Oauth_Config method.
 
- Public Member Functions inherited from Zend_Http_Client
 __construct ($uri=null, $config=null)
 Constructor method.
 
 setUri ($uri)
 Set the URI for the next request.
 
 getUri ($as_string=false)
 Get the URI for the next request.
 
 setConfig ($config=array())
 Set configuration parameters for this HTTP client.
 
 setMethod ($method=self::GET)
 Set the next request's method.
 
 setHeaders ($name, $value=null)
 Set one or more request headers.
 
 getHeader ($key)
 Get the value of a specific header.
 
 setParameterGet ($name, $value=null)
 Set a GET parameter for the request.
 
 setParameterPost ($name, $value=null)
 Set a POST parameter for the request.
 
 getRedirectionsCount ()
 Get the number of redirections done on the last request.
 
 setAuth ($user, $password= '', $type=self::AUTH_BASIC)
 Set HTTP authentication parameters.
 
 setCookieJar ($cookiejar=true)
 Set the HTTP client's cookie jar.
 
 getCookieJar ()
 Return the current cookie jar or null if none.
 
 setCookie ($cookie, $value=null)
 Add a cookie to the request.
 
 setFileUpload ($filename, $formname, $data=null, $ctype=null)
 Set a file to upload (using a POST request)
 
 setEncType ($enctype=self::ENC_URLENCODED)
 Set the encoding type for POST data.
 
 setRawData ($data, $enctype=null)
 Set the raw (already encoded) POST data.
 
 setUnmaskStatus ($status=true)
 Set the unmask feature for GET parameters as array.
 
 getUnmaskStatus ()
 Returns the currently configured unmask status.
 
 resetParameters ($clearAll=false)
 Clear all GET and POST parameters.
 
 getLastRequest ()
 Get the last HTTP request as string.
 
 getLastResponse ()
 Get the last HTTP response received by this client.
 
 setAdapter ($adapter)
 Load the connection adapter.
 
 getAdapter ()
 Load the connection adapter.
 
 setStream ($streamfile=true)
 Set streaming for received data.
 
 getStream ()
 Get status of streaming for received data.
 
 request ($method=null)
 Send the HTTP request and return an HTTP response object.
 

Static Public Attributes

static $supportsRevisionA = false
 Flag to indicate that the client has detected the server as supporting OAuth 1.0a.
 

Protected Member Functions

 _prepareBody ()
 Prepare the request body (for POST and PUT requests)
 
 _getSignableParametersAsQueryString ()
 Collect all signable parameters into a single array across query string and POST body.
 
- Protected Member Functions inherited from Zend_Http_Client
 _setParameter ($type, $name, $value)
 Set a GET or POST parameter - used by SetParameterGet and SetParameterPost.
 
 _openTempStream ()
 Create temporary stream.
 
 _prepareHeaders ()
 Prepare the request headers.
 
 _prepareBody ()
 Prepare the request body (for POST and PUT requests)
 
 _getParametersRecursive ($parray, $urlencode=false)
 Helper method that gets a possibly multi-level parameters array (get or post) and flattens it.
 
 _detectFileMimeType ($file)
 Attempt to detect the MIME type of a file using available extensions.
 

Protected Attributes

 $_config = null
 
 $_streamingRequest = null
 
- Protected Attributes inherited from Zend_Http_Client
 $config
 
 $adapter = null
 
 $uri = null
 
 $headers = array()
 
 $method = self::GET
 
 $paramsGet = array()
 
 $paramsPost = array()
 
 $enctype = null
 
 $raw_post_data = null
 
 $auth
 
 $files = array()
 
 $body_field_order = array()
 
 $cookiejar = null
 
 $last_request = null
 
 $last_response = null
 
 $redirectCounter = 0
 
 $_unmaskStatus = false
 
 $_queryBracketsEscaped = true
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Http_Client
static encodeFormData ($boundary, $name, $value, $filename=null, $headers=array())
 
static encodeAuthHeader ($user, $password, $type=self::AUTH_BASIC)
 Create a HTTP authentication "Authorization:" header according to the specified user, password and authentication method.
 
- Public Attributes inherited from Zend_Http_Client
const GET = 'GET'
 HTTP request methods.
 
const POST = 'POST'
 
const PUT = 'PUT'
 
const HEAD = 'HEAD'
 
const DELETE = 'DELETE'
 
const TRACE = 'TRACE'
 
const OPTIONS = 'OPTIONS'
 
const CONNECT = 'CONNECT'
 
const MERGE = 'MERGE'
 
const PATCH = 'PATCH'
 
const AUTH_BASIC = 'basic'
 Supported HTTP Authentication methods.
 
const HTTP_1 = '1.1'
 HTTP protocol versions.
 
const HTTP_0 = '1.0'
 
const CONTENT_TYPE = 'Content-Type'
 Content attributes.
 
const CONTENT_LENGTH = 'Content-Length'
 
const ENC_URLENCODED = 'application/x-www-form-urlencoded'
 POST data encoding methods.
 
const ENC_FORMDATA = 'multipart/form-data'
 
const VTYPE_SCALAR = 'SCALAR'
 Value types for Body key/value pairs.
 
const VTYPE_FILE = 'FILE'
 
- Static Protected Member Functions inherited from Zend_Http_Client
static _flattenParametersArray ($parray, $prefix=null)
 Convert an array of parameters into a flat array of (key, value) pairs.
 
- Static Protected Attributes inherited from Zend_Http_Client
static $_fileInfoDb = null
 

Constructor & Destructor Documentation

__construct (   $oauthOptions,
  $uri = null,
  $config = null 
)

Constructor; creates a new HTTP Client instance which itself is just a typical Zend_Http_Client subclass with some OAuth icing to assist in automating OAuth parameter generation, addition and cryptographioc signing of requests.

Parameters
array | Zend_Config$oauthOptions
string$uri
array | Zend_Config$config
Returns
void

Member Function Documentation

__call (   $method,
array  $args 
)

Simple Proxy to the current Zend_Oauth_Config method.

It's that instance which holds all configuration methods and values this object also presents as it's API.

Parameters
string$method
array$args
Returns
mixed
Exceptions
Zend_Oauth_Exceptionif method does not exist in config object
_getSignableParametersAsQueryString ( )
protected

Collect all signable parameters into a single array across query string and POST body.

These are returned as a properly formatted single query string.

Returns
string
_prepareBody ( )
protected

Prepare the request body (for POST and PUT requests)

Returns
string
Exceptions
Zend_Http_Client_Exception
getStreamingRequest ( )

Check whether the client is set to perform streaming requests.

Returns
boolean True if yes, false otherwise.
prepareOauth ( )

Performs OAuth preparation on the request before sending.

This primarily means taking a request, correctly encoding and signing all parameters, and applying the correct OAuth scheme to the method being used.

Returns
void
Exceptions
Zend_Oauth_ExceptionIf POSTBODY scheme requested, but GET request method used; or if invalid request scheme provided
request (   $method = null)

Same as Zend_Http_Client::request() except just before the request is executed, we automatically append any necessary OAuth parameters and sign the request using the relevant signature method.

Parameters
string$method
Returns
Zend_Http_Response
resetParameters (   $clearAll = false)

Clear all custom parameters we set.

Returns
Zend_Http_Client
setAdapter (   $adapter)

Load the connection adapter.

Parameters
Zend_Http_Client_Adapter_Interface$adapter
Returns
void
setMethod (   $method = self::GET)

Same as Zend_Http_Client::setMethod() except it also creates an Oauth specific reference to the method type.

Might be defunct and removed in a later iteration.

Parameters
string$method
Returns
Zend_Http_Client
setRawDataStream (   $data,
  $enctype = null 
)

Set the raw (already encoded) POST data from a stream source.

This is used to support POSTing from open file handles without caching the entire body into memory. It is a wrapper around Zend_Http_Client::setRawData().

Parameters
string$dataThe request data
string$enctypeThe encoding type
Returns
Zend_Http_Client
setStreamingRequest (   $value)

Set the streamingRequest variable which controls whether we are sending the raw (already encoded) POST data from a stream source.

Parameters
boolean$valueThe value to set.
Returns
void

Member Data Documentation

$_config = null
protected
$_streamingRequest = null
protected
$supportsRevisionA = false
static

Flag to indicate that the client has detected the server as supporting OAuth 1.0a.