Client

Class Rest_Client Wraps HTTP calls using cURL, aimed for accessing and testing RESTful webservice.

Methods

Private Constructor, sets default options

__construct() 

Execute the call to the webservice

execute() : \Rest\Client

Response

\Rest\Client

Treats URL

treatURL() 

treatResponse

treatResponse($r) 

Arguments

$r

getHeaders

getHeaders() 

getResponse

getResponse() 

getResponseCode

getResponseCode() 

getResponseMessage

getResponseMessage() 

getResponseContentType

getResponseContentType() 

This sets that will not follow redirects

setNoFollow() : \Rest\Client

Response

\Rest\Client

This closes the connection and release resources

close() : \Rest\Client

Response

\Rest\Client

Sets the URL to be Called

setUrl($url) : \Rest\Client

Arguments

$url

Response

\Rest\Client

Set the Content-Type of the request to be send Format like "application/xml" or "text/plain" or other

setContentType(string $contentType) : \Rest\Client

Arguments

$contentType

string

Response

\Rest\Client

Set the Credentials for BASIC Authentication

setCredentials(string $user, string $pass) : \Rest\Client

Arguments

$user

string

$pass

string

Response

\Rest\Client

Set the Request HTTP Method For now, only accepts GET and POST

setMethod(string $method) : \Rest\Client

Arguments

$method

string

Response

\Rest\Client

Set Parameters to be send on the request It can be both a key/value par array (as in array("key"=>"value")) or a string containing the body of the request, like a XML, JSON or other Proper content-type should be set for the body if not a array

setParameters(mixed $params) : \Rest\Client

Arguments

$params

mixed

Response

\Rest\Client

Creates the Client

createClient(string $url = null) : \Rest\Client
static

Arguments

$url

string

Response

\Rest\Client

Convenience method wrapping a commom POST call

post(string $url, mixed $params = null, string $user = null, string $password = null, string $contentType = "application/x-www-form-urlencoded") : \Rest\Client
static

Arguments

$url

string

$params

mixed

$user

string

$password

string

$contentType

string

Response

\Rest\Client

Convenience method wrapping a commom PUT call

put(string $url, string $body, string $user = null, string $password = null, string $contentType = null) : \Rest\Client
static

Arguments

$url

string

$body

string

$user

string

$password

string

$contentType

string

Response

\Rest\Client

Convenience method wrapping a commom GET call

get(string $url, array $params = null, string $user = null, string $password = null) : \Rest\Client
static

Arguments

$url

string

$params

array

$user

string

$password

string

Response

\Rest\Client

Convenience method wrapping a commom delete call

delete(string $url, array $params = null, string $user = null, string $password = null) : \Rest\Client
static

Arguments

$url

string

$params

array

$user

string

$password

string

Response

\Rest\Client

Convenience method wrapping a commom custom call

call(string $method, string $url, string $body, string $user = null, string $password = null, string $contentType = null) : \Rest\Client
static

Arguments

$method

string

$url

string

$body

string

$user

string

$password

string

$contentType

string

Response

\Rest\Client

Properties

curl

curl

url

url

response

response

headers

headers

method

method

params

params

contentType

contentType

file

file