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

Public Member Functions

 setAuthSubPrivateKeyFile ($file, $passphrase=null, $useIncludePath=false)
 Sets the PEM formatted private key, as read from a file.
 
 setAuthSubPrivateKey ($key, $passphrase=null)
 Sets the PEM formatted private key to be used for secure AuthSub auth.
 
 getAuthSubPrivateKeyId ()
 Gets the openssl private key id.
 
 getAuthSubToken ()
 Gets the AuthSub token used for authentication.
 
 setAuthSubToken ($token)
 Sets the AuthSub token used for authentication.
 
 getClientLoginToken ()
 Gets the ClientLogin token used for authentication.
 
 setClientLoginToken ($token)
 Sets the ClientLogin token used for authentication.
 
 filterHttpRequest ($method, $url, $headers=array(), $body=null, $contentType=null)
 Filters the HTTP requests being sent to add the Authorization header.
 
 filterHttpResponse ($response)
 Method for filtering the HTTP response, though no filtering is currently done.
 
 getAdapter ()
 Return the current connection adapter.
 
 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.
 
- 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.
 

Protected Member Functions

 _prepareBody ()
 Prepare the request body (for POST and PUT requests)
 
- 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

 $_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
 

Member Function Documentation

_prepareBody ( )
protected

Prepare the request body (for POST and PUT requests)

Returns
string
Exceptions
Zend_Http_Client_Exception
filterHttpRequest (   $method,
  $url,
  $headers = array(),
  $body = null,
  $contentType = null 
)

Filters the HTTP requests being sent to add the Authorization header.

If both AuthSub and ClientLogin tokens are set, AuthSub takes precedence. If an AuthSub key is set, then secure AuthSub authentication is used, and the request is signed. Requests must be signed only with the private key corresponding to the public key registered with Google. If an AuthSub key is set, but openssl support is not enabled in the PHP installation, an exception is thrown.

Parameters
string$methodThe HTTP method
string$urlThe URL
array$headersAn associate array of headers to be sent with the request or null
string$bodyThe body of the request or null
string$contentTypeThe MIME content type of the body or null
Exceptions
Zend_Gdata_App_Exceptionif there was a signing failure
Returns
array The processed values in an associative array, using the same names as the params
filterHttpResponse (   $response)

Method for filtering the HTTP response, though no filtering is currently done.

Parameters
Zend_Http_Response$responseThe response object to filter
Returns
Zend_Http_Response The filterd response object
getAdapter ( )

Return the current connection adapter.

Returns
Zend_Http_Client_Adapter_Interface|string $adapter
getAuthSubPrivateKeyId ( )

Gets the openssl private key id.

Returns
string The private key
getAuthSubToken ( )

Gets the AuthSub token used for authentication.

Returns
string The token
getClientLoginToken ( )

Gets the ClientLogin token used for authentication.

Returns
string The token
getStreamingRequest ( )

Check whether the client is set to perform streaming requests.

Returns
boolean True if yes, false otherwise.
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
setAuthSubPrivateKey (   $key,
  $passphrase = null 
)

Sets the PEM formatted private key to be used for secure AuthSub auth.

In order to call this method, openssl must be enabled in your PHP installation. Otherwise, a Zend_Gdata_App_InvalidArgumentException will be thrown.

Parameters
string$keyThe private key
string$passphraseThe optional private key passphrase
Exceptions
Zend_Gdata_App_InvalidArgumentException
Returns
Zend_Gdata_HttpClient Provides a fluent interface
setAuthSubPrivateKeyFile (   $file,
  $passphrase = null,
  $useIncludePath = false 
)

Sets the PEM formatted private key, as read from a file.

This method reads the file and then calls setAuthSubPrivateKey() with the file contents.

Parameters
string$fileThe location of the file containing the PEM key
string$passphraseThe optional private key passphrase
bool$useIncludePathWhether to search the include_path for the file
Returns
void
setAuthSubToken (   $token)

Sets the AuthSub token used for authentication.

Parameters
string$tokenThe token
Returns
Zend_Gdata_HttpClient Provides a fluent interface
setClientLoginToken (   $token)

Sets the ClientLogin token used for authentication.

Parameters
string$tokenThe token
Returns
Zend_Gdata_HttpClient Provides a fluent interface
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

$_streamingRequest = null
protected