HTTP request method uses fopen function to retrieve the url.

Requires PHP version greater than 4.3.0 for stream support. Does not allow for $context support, but should still be okay, to write the headers, before getting the response. Also requires that 'allow_url_fopen' to be enabled.

package WordPress
subpackage HTTP
since 2.7.0

 Methods

Send a HTTP request to a URI using fopen().

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

This transport does not support sending of headers and body, therefore should not be used in the instances, where there is a body and headers.

Notes: Does not support non-blocking mode. Ignores 'redirection' option.

see For default options descriptions.
access public
since 2.7.0

Parameters

$url

string

URI resource.

$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
since 2.7.0
static

Parameters

$args

Returns

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