SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class HttpReq

Simple HTTP(s) request wrapper

Variables

NameVisibilityDescription
$http_headers (static) 
$http_info (static) 
$http_status (static) 

Functions

NameVisibilityDescription
buildHeadersStringprotected (static)Converts an array of headers into a \r\n-delimeted string
getpublic (static)Make a simple GET request.
getLastreqHeaderspublic (static)Return headers of the last request
getLastreqInfopublic (static)Return info of the last request
getLastreqStatuspublic (static)Return the http status code ofthe last request
postpublic (static)Make a simple POST request, with optional data
reqpublic (static)Make a HTTP request. Returns the response content.
reqAdvancedpublic (static)Performs a request while permitting advanced cURL options to be specified.
reqCurlprivate (static)Sends a HTTP request using cURL.
reqFopenprivate (static)Sends a HTTP request using fopen (i.e. file_get_contents)

protected buildHeadersString

string 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 get

string HttpReq::get ( string $url );

Make a simple GET request.
If you need more control, use @see HttpReq::req

public getLastreqHeaders

array HttpReq::getLastreqHeaders ( );

Return headers of the last request

public getLastreqInfo

array HttpReq::getLastreqInfo ( );

Return info of the last request

public getLastreqStatus

int HttpReq::getLastreqStatus ( );

Return the http status code ofthe last request

public post

string HttpReq::post ( string $url [, array $data ] );

Make a simple POST request, with optional data
If you need more control, use @see HttpReq::req

public req

Reponse 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 information

public reqAdvanced

string 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 reqCurl

unknown HttpReq::reqCurl ( mixed $url , array $opts [, mixed $data ] );

Sends a HTTP request using cURL.

private reqFopen

unknown HttpReq::reqFopen ( mixed $url , array $opts [, mixed $data ] );

Sends a HTTP request using fopen (i.e. file_get_contents)