Simple HTTP(s) request wrapper
This is the code documentation for the SproutCMS project
Search documentation |
class HttpReqSimple HTTP(s) request wrapper
Variables
Functions
protected buildHeadersStringstring HttpReq::buildHeadersString ( string/array $headers ); Converts an array of headers into a \r\n-delimeted string Accepts three formats: - Strings will be passed through as is. - Arrays of strings (with numeric keys) will be used as-is - Arrays of strings (with string keys) will be joined using : to separate the key and value. Also, values containing quotes or spaces will be quoted. public getstring HttpReq::get ( string $url ); Make a simple GET request. If you need more control, use @see HttpReq::req public getLastreqHeadersarray HttpReq::getLastreqHeaders ( ); Return headers of the last request public getLastreqInfoarray HttpReq::getLastreqInfo ( ); Return info of the last request public getLastreqStatusint HttpReq::getLastreqStatus ( ); Return the http status code ofthe last request public poststring HttpReq::post ( string $url [, array $data ] ); Make a simple POST request, with optional data If you need more control, use @see HttpReq::req public reqReponse HttpReq::req ( string $url , array $opts [, string/array $data ] );
Make a HTTP request. Returns the response content.
The request options array accepts the following keys:
method The HTTP method to use ('GET', 'POST')
headers An array of headers; see ::buildHeadersString
for format informationpublic reqAdvancedstring HttpReq::reqAdvanced ( string $url , string $method [, string|array $post_data , array $curl_options ] ); Performs a request while permitting advanced cURL options to be specified. Essentially just a wrapper around cURL that has some sane options set by default; e.g. return transfer, no return headers, SSL configured, proxy settings. private reqCurlunknown HttpReq::reqCurl ( mixed $url , array $opts [, mixed $data ] ); Sends a HTTP request using cURL. private reqFopenunknown HttpReq::reqFopen ( mixed $url , array $opts [, mixed $data ] ); Sends a HTTP request using fopen (i.e. file_get_contents) |
| Powered by Pelzini, version 0.9.0 |
Documentation is made available under the
GNU Free Documentation License 1.2. Generated: Tuesday, 15th September, 2026 at 10:26 am |
|