Wrapper for curl to create http requests

 Methods

Creates connector object

__construct() 

access public

Clean up

__destruct() 

access public

Get headers

getHeaders() : array

access public

Returns

array

Get last response

getLastResponse() : string

access public

Returns

string

Number of requests left

requestsLeft() : int

Returns

int

Perform the request

send(string $url, string $requestMethod, string $data, array $headers) : string

access public

Parameters

$url

string

URL of request

$requestMethod

string

(GET|POST|PUT|DELETE)

$data

string

Data in string format

$headers

array

Exceptions

\Moneybird\HttpClient_Exception
\Moneybird\HttpClient_HttpStatusException
\Moneybird\HttpClient_UnknownHttpStatusException
\Moneybird\HttpClient_ConnectionErrorException

Returns

string

Set credentials for the connection

setAuth(string $username, string $password) : \Moneybird\HttpClient

access public

Parameters

$username

string

Username

$password

string

Password

Returns

Set useragent

setUserAgent(string $userAgent) : \Moneybird\HttpClient

access public

Parameters

$userAgent

string

Returns

Close connection

closeConnection() : \Moneybird\HttpClient

access protected

Returns

Execute request Redirects via cURL option CURLOPT_FOLLOWLOCATION won't work if safe mode or open basedir is active

exec() : \Moneybird\HttpClient

Throws exceptions if httpStatus contains error status

handleError() 

Init connection

openConnection() : \Moneybird\HttpClient

Prepare DELETE request

preDeleteRequest() : \Moneybird\HttpClient

access protected

Returns

Prepare GET request

preGetRequest() : \Moneybird\HttpClient

access protected

Returns

Prepare POST request

prePostRequest($data) : \Moneybird\HttpClient

access protected

Parameters

$data

Returns

Prepare PUT request

prePutRequest($data) : \Moneybird\HttpClient

access protected

Parameters

$data

Returns

Set connection options

setConnectionOptions(array $options) : \Moneybird\HttpClient

access protected

Parameters

$options

array

Exceptions

\Moneybird\HttpClient_ConnectionErrorException

Returns

 Properties

 

Verify host and peer

$verifyHostAndPeer : bool

access protected
static
 

Curl handler

$connection : resource

access protected
 

Connection defaults

$connectionOptions : array

access protected
 

Http Status code

$httpStatus : int

access protected
 

Headers of last request

$lastHeader : string

access protected
 

Response string

$response : string

access protected
 

Filehandler for temp file

$tmpFile : resource

access protected