[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/Requests/Transport/ -> Curl.php (summary)

cURL HTTP transport

File Size: 641 lines (20 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 12 functions

  __construct()
  __destruct()
  request()
  request_multiple()
  get_subrequest_handle()
  setup_handle()
  process_response()
  stream_headers()
  stream_body()
  format_get()
  test()
  get_expect_header()

Functions
Functions that are not part of a class:

__construct()   X-Ref
Constructor


__destruct()   X-Ref
Destructor


request($url, $headers = [], $data = [], $options = [])   X-Ref
Perform a request

return: string Raw HTTP result
param: string|Stringable $url URL to request
param: array $headers Associative array of request headers
param: string|array $data Data to send either as the POST body, or as parameters in the URL for a GET/HEAD
param: array $options Request options, see {@see \WpOrg\Requests\Requests::response()} for documentation

request_multiple($requests, $options)   X-Ref
Send multiple requests simultaneously

return: array Array of \WpOrg\Requests\Response objects (may contain \WpOrg\Requests\Exception or string responses as well)
param: array $requests Request data
param: array $options Global options

get_subrequest_handle($url, $headers, $data, $options)   X-Ref
Get the cURL handle for use in a multi-request

return: resource|\CurlHandle Subrequest's cURL handle
param: string $url URL to request
param: array $headers Associative array of request headers
param: string|array $data Data to send either as the POST body, or as parameters in the URL for a GET/HEAD
param: array $options Request options, see {@see \WpOrg\Requests\Requests::response()} for documentation

setup_handle($url, $headers, $data, $options)   X-Ref
Setup the cURL handle for the given data

param: string $url URL to request
param: array $headers Associative array of request headers
param: string|array $data Data to send either as the POST body, or as parameters in the URL for a GET/HEAD
param: array $options Request options, see {@see \WpOrg\Requests\Requests::response()} for documentation

process_response($response, $options)   X-Ref
Process a response

return: string|false HTTP response data including headers. False if non-blocking.
param: string $response Response data from the body
param: array $options Request options

stream_headers($handle, $headers)   X-Ref
Collect the headers as they are received

return: integer Length of provided header
param: resource|\CurlHandle $handle cURL handle
param: string $headers Header string

stream_body($handle, $data)   X-Ref
Collect data as it's received

return: integer Length of provided data
param: resource|\CurlHandle $handle cURL handle
param: string $data Body data

format_get($url, $data)   X-Ref
Format a URL given GET data

return: string URL with data
param: string $url
param: array|object $data Data to build query using, see {@link https://www.php.net/http_build_query}

test($capabilities = [])   X-Ref
Self-test whether the transport can be used.

The available capabilities to test for can be found in {@see \WpOrg\Requests\Capability}.

return: bool Whether the transport can be used.
param: array<string, bool> $capabilities Optional. Associative array of capabilities to test against, i.e. `['<capability>' => true]`.

get_expect_header($data)   X-Ref
Get the correct "Expect" header for the given request data.

return: string The "Expect" header.
param: string|array $data Data to send either as the POST body, or as parameters in the URL for a GET/HEAD.



Generated : Mon Dec 6 08:20:01 2021 Cross-referenced by PHPXref