HTTP request method uses HTTP extension to retrieve the url.

Requires the HTTP extension to be installed. This would be the preferred transport since it can handle a lot of the problems that forces the others to use the HTTP version 1.0. Even if PHP 5.2+ is being used, it doesn't mean that the HTTP extension will be enabled.

package WordPress
subpackage HTTP
since 2.7.0

 Methods

Send a HTTP request to a URI using HTTP extension.

request(string $url, \str|array $args = array()) : array

Does not support non-blocking.

access public
since 2.7

Parameters

$url

string

$args

\strarray

Optional. Override the defaults.

Returns

array'headers', 'body', 'cookies' and 'response' keys.

Whether this class can be used for retrieving an URL.

test($args = array()) : boolean
Static
static
since 2.7.0

Parameters

$args

Returns

booleanFalse means this class can not be used, true means it can.