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

Public Member Functions

 __construct ($uri=null)
 Constructor.
 
 setUri ($uri)
 Set the URI to use in the request.
 
 getUri ()
 Retrieve the current request URI object.
 
 setNoReset ($bool=true)
 Tells Zend_Rest_Client not to reset all parameters on it's Zend_Http_Client.
 
 restGet ($path, array $query=null)
 Performs an HTTP GET request to the $path.
 
 restPost ($path, $data=null)
 Performs an HTTP POST request to $path.
 
 restPut ($path, $data=null)
 Performs an HTTP PUT request to $path.
 
 restDelete ($path, $data=null)
 Performs an HTTP DELETE request to $path.
 
 __call ($method, $args)
 Method call overload.
 

Protected Member Functions

 _performPost ($method, $data=null)
 Perform a POST or PUT.
 

Protected Attributes

 $_data = array()
 
 $_uri = null
 
 $_noReset = false
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Service_Abstract
static setHttpClient (Zend_Http_Client $httpClient)
 Sets the HTTP client object to use for retrieving the feeds.
 
static getHttpClient ()
 Gets the HTTP client object.
 
- Static Protected Attributes inherited from Zend_Service_Abstract
static $_httpClient = null
 

Constructor & Destructor Documentation

__construct (   $uri = null)

Constructor.

Parameters
string | Zend_Uri_Http$uriURI for the web service
Returns
void

Member Function Documentation

__call (   $method,
  $args 
)

Method call overload.

Allows calling REST actions as object methods; however, you must follow-up by chaining the request with a request to an HTTP request method (post, get, delete, put): $response = $rest->sayHello('Foo', 'Manchu')->get();

Or use them together, but in sequential calls: $rest->sayHello('Foo', 'Manchu'); $response = $rest->get();

Parameters
string$methodMethod name
array$argsMethod args
Returns
Zend_Rest_Client_Result|Zend_Rest_Client Zend_Rest_Client if using a remote method, Zend_Rest_Client_Result if using an HTTP request method
_performPost (   $method,
  $data = null 
)
protected

Perform a POST or PUT.

Performs a POST or PUT request. Any data provided is set in the HTTP client. String data is pushed in as raw POST data; array or object data is pushed in as POST parameters.

Parameters
mixed$method
mixed$data
Returns
Zend_Http_Response
getUri ( )

Retrieve the current request URI object.

Returns
Zend_Uri_Http
restDelete (   $path,
  $data = null 
)

Performs an HTTP DELETE request to $path.

Parameters
string$path
Exceptions
Zend_Http_Client_Exception
Returns
Zend_Http_Response
restGet (   $path,
array  $query = null 
)

Performs an HTTP GET request to the $path.

Parameters
string$path
array$queryArray of GET parameters
Exceptions
Zend_Http_Client_Exception
Returns
Zend_Http_Response
restPost (   $path,
  $data = null 
)

Performs an HTTP POST request to $path.

Parameters
string$path
mixed$dataRaw data to send
Exceptions
Zend_Http_Client_Exception
Returns
Zend_Http_Response
restPut (   $path,
  $data = null 
)

Performs an HTTP PUT request to $path.

Parameters
string$path
mixed$dataRaw data to send in request
Exceptions
Zend_Http_Client_Exception
Returns
Zend_Http_Response
setNoReset (   $bool = true)

Tells Zend_Rest_Client not to reset all parameters on it's Zend_Http_Client.

If you want no reset, this must be called explicitly before every request for which you do not want to reset the parameters. Parameters will accumulate between requests, but as soon as you do not call this function prior to any request, all preset parameters will be reset as by default.

Parameters
boolean$bool
setUri (   $uri)

Set the URI to use in the request.

Parameters
string | Zend_Uri_Http$uriURI for the web service
Returns
Zend_Rest_Client

Member Data Documentation

$_data = array()
protected
$_noReset = false
protected
$_uri = null
protected