Property | Type | Description | |
---|---|---|---|
$handlers | array | Mapping of content types to handlers for them | |
$response | Phergie_Plugin_Http_Response | Response to the last executed HTTP request |
Method | Description | |
---|---|---|
get ( string $url, array $query = [], array $context = [] ) : Phergie_Plugin_Http_Response | Performs a GET request. | |
handleError ( integer $errno, string $errstr, string $errfile, string $errline ) : boolean | Supporting method that acts as an error handler to intercept HTTP responses resulting in PHP-level errors. | |
head ( string $url, array $query = [], array $context = [] ) : Phergie_Plugin_Http_Response | Performs a HEAD request. | |
onLoad ( ) : void | Initializes the handler lookup table. | |
post ( string $url, array $query = [], array $post = [], array $context = [] ) : Phergie_Plugin_Http_Response | Performs a POST request. | |
request ( string $url, array $context ) : Phergie_Plugin_Http_Response | Supporting method that executes a request and handles the response. | |
setHandler ( string $type, callback $callback ) : Phergie_Plugin_Http | Sets a handler callback for a content type, which is called when a response of that content type is received to perform any needed transformations on the response body content before storing it in the response object. Note that the calling plugin is responsible for indicating any dependencies related to specified handler callbacks. |
Method | Description | |
---|---|---|
parseStatusLine ( string $status ) : array | Supporting method that parses the status line of an HTTP response message. |
public get ( string $url, array $query = [], array $context = [] ) : Phergie_Plugin_Http_Response | ||
$url | string | URL for the request |
$query | array | Optional associative array of parameters constituting the URL query string if $url has none |
$context | array | Optional associative array of additional stream context parameters |
return | Phergie_Plugin_Http_Response | Received response data |
public handleError ( integer $errno, string $errstr, string $errfile, string $errline ) : boolean | ||
$errno | integer | Level of the error raised |
$errstr | string | Error message |
$errfile | string | Name of the file in which the error was raised |
$errline | string | Line number on which the error was raised |
return | boolean | Always returns TRUE to allow normal execution to continue once this method terminates |
public head ( string $url, array $query = [], array $context = [] ) : Phergie_Plugin_Http_Response | ||
$url | string | URL for the request |
$query | array | Optional associative array of parameters constituting the URL query string if $url has none |
$context | array | Optional associative array of additional stream context parameters |
return | Phergie_Plugin_Http_Response | Received response data |
protected parseStatusLine ( string $status ) : array | ||
$status | string | Status line |
return | array | Associative array containing the HTTP version, response code, and response description |
public post ( string $url, array $query = [], array $post = [], array $context = [] ) : Phergie_Plugin_Http_Response | ||
$url | string | URL for the request |
$query | array | Optional associative array of parameters constituting the URL query string if $url has none |
$post | array | Optional associative array of parameters constituting the POST request body if it is using the traditional URL-encoded format |
$context | array | Optional associative array of additional stream context parameters |
return | Phergie_Plugin_Http_Response | Received response data |
public setHandler ( string $type, callback $callback ) : Phergie_Plugin_Http | ||
$type | string | PCRE regular expression (without delimiters) that matches one or more MIME types |
$callback | callback | Callback to execute when a response of a content type matched by $type is encountered |
return | Phergie_Plugin_Http | Provides a fluent interface |
protected array $handlers | ||
return | array |