Requests 2.0.13 API

Transport

Base HTTP transport

Table of Contents

Methods

request()  : string
Perform a request
request_multiple()  : array<string|int, mixed>
Send multiple requests simultaneously
test()  : bool
Self-test whether the transport can be used.

Methods

request()

Perform a request

public request(string $url[, array<string|int, mixed> $headers = [] ][, string|array<string|int, mixed> $data = [] ][, array<string|int, mixed> $options = [] ]) : string
Parameters
$url : string

URL to request

$headers : array<string|int, mixed> = []

Associative array of request headers

$data : string|array<string|int, mixed> = []

Data to send either as the POST body, or as parameters in the URL for a GET/HEAD

$options : array<string|int, mixed> = []

Request options, see Requests::response() for documentation

Return values
string

Raw HTTP result

request_multiple()

Send multiple requests simultaneously

public request_multiple(array<string|int, mixed> $requests, array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$requests : array<string|int, mixed>

Request data (array of 'url', 'headers', 'data', 'options') as per Transport::request()

$options : array<string|int, mixed>

Global options, see Requests::response() for documentation

Return values
array<string|int, mixed>

Array of \WpOrg\Requests\Response objects (may contain \WpOrg\Requests\Exception or string responses as well)

test()

Self-test whether the transport can be used.

public static test([array<string, bool> $capabilities = [] ]) : bool

The available capabilities to test for can be found in Capability.

Parameters
$capabilities : array<string, bool> = []

Optional. Associative array of capabilities to test against, i.e. ['<capability>' => true].

Return values
bool

Whether the transport can be used.


        
On this page

Search results