Public Member Functions | |
| __construct ($url, $method= 'GET', $timeout=180) | |
| __set_processor ($processor) | |
| set_config ($config, $value=null) | |
| add_header ($header) | |
| add_headers ($headers) | |
| set_body ($body) | |
| set_params ($params) | |
| set_timeout ($timeout) | |
| set_postdata ($name, $value=null) | |
| set_file ($name, $filename, $content_type=null, $override_filename=null) | |
| execute () | |
| executed () | |
| get_response_headers () | |
| get_response_body () | |
Static Public Member Functions | |
| static | get_contents ($url, $use_include_path=false, $context=null, $offset=0, $maxlen=-1) |
Generic class to make outgoing HTTP requests.
Definition at line 50 of file remoterequest.php.
| RemoteRequest::__construct | ( | $ | url, | |
| $ | method = 'GET', |
|||
| $ | timeout = 180 | |||
| ) |
| string | $url URL to request | |
| string | $method Request method to use (default 'GET') | |
| int | $timeuot Timeout in seconds (default 180) |
Definition at line 103 of file remoterequest.php.
| RemoteRequest::__set_processor | ( | $ | processor | ) |
DO NOT USE THIS FUNCTION. This function is only to be used by the test case for RemoteRequest!
Definition at line 156 of file remoterequest.php.
| RemoteRequest::add_header | ( | $ | header | ) |
Add a request header.
| mixed | $header The header to add, either as a string 'Name: Value' or an associative array 'name'=>'value' |
Definition at line 188 of file remoterequest.php.
Referenced by __construct(), and add_headers().
| RemoteRequest::add_headers | ( | $ | headers | ) |
Add a list of headers.
| array | $headers List of headers to add. |
Definition at line 203 of file remoterequest.php.
| RemoteRequest::execute | ( | ) |
Actually execute the request. On success, returns true and populates the response_body and response_headers fields. On failure, throws Exception.
| Exception |
Definition at line 343 of file remoterequest.php.
| static RemoteRequest::get_contents | ( | $ | url, | |
| $ | use_include_path = false, |
|||
| $ | context = null, |
|||
| $ | offset = 0, |
|||
| $ | maxlen = -1 | |||
| ) | [static] |
Static helper function to quickly fetch an URL, with semantics similar to PHP's file_get_contents. Does not support
Returns the content on success or false if an error occurred.
| string | $url The URL to fetch | |
| bool | $use_include_path whether to search the PHP include path first (unsupported) | |
| resource | $context a stream context to use (unsupported) | |
| int | $offset how many bytes to skip from the beginning of the result | |
| int | $maxlen how many bytes to return |
Definition at line 445 of file remoterequest.php.
| RemoteRequest::get_response_body | ( | ) |
Return the response body. Raises a warning and returns '' if the request wasn't executed yet.
Definition at line 385 of file remoterequest.php.
| RemoteRequest::get_response_headers | ( | ) |
Return the response headers. Raises a warning and returns '' if the request wasn't executed yet.
Definition at line 372 of file remoterequest.php.
| RemoteRequest::set_body | ( | $ | body | ) |
Set the request body. Only used with POST requests, will raise a warning if used with GET.
| string | $body The request body. |
Definition at line 215 of file remoterequest.php.
| RemoteRequest::set_config | ( | $ | config, | |
| $ | value = null | |||
| ) |
Set adapter configuration options
| mixed | $config An array of options or a string name with a corresponding $value | |
| mixed | $value |
Definition at line 167 of file remoterequest.php.
Referenced by __construct().
| RemoteRequest::set_file | ( | $ | name, | |
| $ | filename, | |||
| $ | content_type = null, |
|||
| $ | override_filename = null | |||
| ) |
set file
public
| string | $name | |
| string | $filename | |
| string | $content_type |
Definition at line 272 of file remoterequest.php.
| RemoteRequest::set_params | ( | $ | params | ) |
Set the request query parameters (i.e., the URI's query string). Will be merged with existing query info from the URL.
| array | $params |
Definition at line 229 of file remoterequest.php.
| RemoteRequest::set_postdata | ( | $ | name, | |
| $ | value = null | |||
| ) |
set postdata
public
| mixed | $name | |
| string | $value |
Definition at line 254 of file remoterequest.php.
| RemoteRequest::set_timeout | ( | $ | timeout | ) |
Set the timeout.
| int | $timeout Timeout in seconds |
Definition at line 241 of file remoterequest.php.
Referenced by __construct().
1.7.1