Method | Description | |
---|---|---|
__construct ( $hostUri, $port = 80 ) | Curl to $hostUri on $port | |
delete ( $path, array $getParams, array $headers = null, null $cookies = null ) : array | HTTP Delete Request | |
get ( string $path, array $getParams, array $headers = null, array $cookies = null ) : array | ||
post ( string $path, array $getParams, string | array $postData, array $headers = null, string $cookies = null ) : array | HTTP Post Request | |
put ( string $path, array $getParams, mixed $body = null, array $headers = null, string $cookies = null ) : array | PUT a json body | |
setAuth ( string $user, string $pwd, integer $method = CURLAUTH_BASIC ) | Set any authentication credentials desired for request(s) | |
setPhpCurlOpts ( array $curlOpts ) | Fall back method to set your own curl options not currenctly explicitly support |
Method | Description | |
---|---|---|
buildFullPath ( $subUri ) | ||
buildFullUri ( string $path, string[] $getVars ) : string | build the full URI request | |
parseHeaders ( $headerString ) : array | Parse the headers into an array that matches that pattern of http://php.net/manual/en/function.http-parse-headers.php | |
request ( $httpMethod, $path, array $getParams, $body, array $headers = null, $cookies = null ) |
public get ( string $path, array $getParams, array $headers = null, array $cookies = null ) : array | ||
$path | string | The resource path to be appended to the base URI |
$getParams | array | key-value pairs |
$headers | array | array of valid HTTP header strings; e.g. ['Accept: application/json'] |
$cookies | array | The contents of the "Cookie: " header to be used in the HTTP request. Note that multiple cookies are separated with a semicolon followed by a space |
return | array | Response and info |
public post ( string $path, array $getParams, string | array $postData, array $headers = null, string $cookies = null ) : array | ||
$path | string | relative path from base hostUri |
$getParams | array | An associative array of get parameters |
$postData | string | array | The data to send in your post |
$headers | array | associative array of headers to include |
$cookies | string | Cookies to include |
return | array | Remote response body |
public put ( string $path, array $getParams, mixed $body = null, array $headers = null, string $cookies = null ) : array | ||
$path | string | relative path from base hostUri |
$getParams | array | An associative array of get parameters |
$body | mixed | Optional array or string request body data to send |
$headers | array | Optional headers to send with PUT |
$cookies | string | Cookies to include |
return | array | Remote response body |
public setPhpCurlOpts ( array $curlOpts ) | ||
$curlOpts | array | An array specifying which options to set and their values. The keys must be valid curl_setopt() constants or their integer equivalents. |