Public Member Functions | Public Attributes | Protected Attributes

RestClientModel Class Reference

REST client model uses internally "curl" or cake HttpSocket if "curl" module not available. More...

Inheritance diagram for RestClientModel:
BEAppModel AppModel

List of all members.

Public Member Functions

 setup ()
 setup rest client if curl available setup RestClientModel to use it else setup RestClientModel to use CakePHP HttpSocket class
 setOptions (array $options=array(), $merge=false)
 set self::requestOptions
 get ($uri, $params=array(), $outType=null, $camelize=true)
 Do a HTTP GET request and returns output response.
 post ($uri, $params=array(), $outType=null, $camelize=true)
 Do a HTTP POST request and returns output response.
 request ($uri, $method="GET", $params=array(), $outType=null, $camelize=true)
 Do a generic HTTP request using custom $method and returns output response.

Public Attributes

 $useTable = false
 $httpReady = false
 $client
 $useCurl = false

Protected Attributes

 $requestOptions = array()

Detailed Description

REST client model uses internally "curl" or cake HttpSocket if "curl" module not available.

Definition at line 26 of file rest_client_model.php.


Member Function Documentation

RestClientModel::get ( uri,
params = array(),
outType = null,
camelize = true 
)

Do a HTTP GET request and returns output response.

Output may be parsed (only xml/json) using $outType argument ("xml" or "json").

Parameters:
string $uri URL to GET
array $params, URL query parameters
string $outType, can be "xml" or "json", if present output will be parsed if "xml" => php array, if "json" => json_decode is called
boolean $camelize, used if $outType = 'xml' true (default) camelize array keys corresponding to xml items that contain other xml items (CakePHP default behavior) false leave array keys equal to xml items

Definition at line 106 of file rest_client_model.php.

RestClientModel::post ( uri,
params = array(),
outType = null,
camelize = true 
)

Do a HTTP POST request and returns output response.

Output may be parsed (only xml/json) using $outType argument ("xml" or "json").

Parameters:
string $uri, HTTP POST URL
mixed $params, POST query parameters, if array is encoded with http_build_query
string $outType, can be "xml" or "json", if present output will be parsed if "xml" => php array, if "json" => json_decode is called
boolean $camelize, used if $outType = 'xml' true (default) camelize array keys corresponding to xml items that contain other xml items (CakePHP default behavior) false leave array keys equal to xml items

Definition at line 157 of file rest_client_model.php.

RestClientModel::request ( uri,
method = "GET",
params = array(),
outType = null,
camelize = true 
)

Do a generic HTTP request using custom $method and returns output response.

Output may be parsed (only xml/json) using $outType argument ("xml" or "json").

Parameters:
string $uri URL to request
string $methot HTTP request method, default "GET"
array $params, URL query parameters
string $outType, can be "xml" or "json", if present output will be parsed if "xml" => php array, if "json" => json_decode is called
boolean $camelize, used if $outType = 'xml' true (default) camelize array keys corresponding to xml items that contain other xml items (CakePHP default behavior) false leave array keys equal to xml items

Definition at line 220 of file rest_client_model.php.

RestClientModel::setOptions ( array $  options = array(),
merge = false 
)

set self::requestOptions

Parameters:
array $options
boolean $merge true if $options has to be merged with self::requestOptions. Default false

Definition at line 85 of file rest_client_model.php.


The documentation for this class was generated from the following file:
Generated on Fri Dec 11 2015 15:29:47 by Doxygen 1.7.1  BEditaBEdita 3.7 Corylus