[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

cURL HTTP transport

File Size: 640 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

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
return: string Raw HTTP result

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

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

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

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
return: resource|\CurlHandle Subrequest's cURL handle

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

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

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

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

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

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

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

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

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}.

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

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

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



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref