class CRM_Utils_HttpClient

This class handles HTTP downloads

FIXME: fetch() and get() report errors differently -- e.g. fetch() returns fatal and get() returns an error code. Should refactor both (or get a third-party HTTP library) but don't want to deal with that so late in the 4.3 dev cycle.

Constants

STATUS_OK

STATUS_WRITE_ERROR

STATUS_DL_ERROR

Properties

static protected CRM_Utils_HttpClient $singleton
protected int|NULL $connectionTimeout

Methods

singleton()

No description

__construct(null $connectionTimeout = NULL)

No description

STATUS_OK|STATUS_WRITE_ERROR|STATUS_DL_ERROR
fetch(string $remoteFile, string $localFile)

Download the remote zipfile.

array
get(string $remoteFile)

Send an HTTP GET for a remote resource.

array
post(string $remoteFile, array $params)

Send an HTTP POST for a remote resource.

array
createCurl(string $remoteFile)

No description

bool
isRedirectSupported()

No description

Details

at line 59
static CRM_Utils_HttpClient singleton()

Return Value

CRM_Utils_HttpClient

at line 69
__construct(null $connectionTimeout = NULL)

Parameters

null $connectionTimeout

at line 82
STATUS_OK|STATUS_WRITE_ERROR|STATUS_DL_ERROR fetch(string $remoteFile, string $localFile)

Download the remote zipfile.

Parameters

string $remoteFile URL of a .zip file.
string $localFile Path at which to store the .zip file.

Return Value

STATUS_OK|STATUS_WRITE_ERROR|STATUS_DL_ERROR

at line 120
array get(string $remoteFile)

Send an HTTP GET for a remote resource.

Parameters

string $remoteFile URL of remote file.

Return Value

array array(0 => STATUS_OK|STATUS_DL_ERROR, 1 => string)

at line 160
array post(string $remoteFile, array $params)

Send an HTTP POST for a remote resource.

Parameters

string $remoteFile URL of a .zip file.
array $params

Return Value

array array(0 => STATUS_OK|STATUS_DL_ERROR, 1 => string)

at line 194
protected array createCurl(string $remoteFile)

Parameters

string $remoteFile

Return Value

array (0 => resource, 1 => CA_Config_Curl)

at line 220
bool isRedirectSupported()

Return Value

bool