[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
HTTP API: WP_Http class
File Size: | 1121 lines (42 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 1 file wp-includes/Requests/src/Autoload.php |
WP_Http:: (18 methods):
request()
normalize_cookies()
browser_redirect_compatibility()
validate_redirects()
_get_first_available_transport()
_dispatch_request()
post()
get()
head()
processResponse()
processHeaders()
buildCookieHeader()
chunkTransferDecode()
block_request()
parse_url()
make_absolute_url()
handle_redirects()
is_ip_address()
request( $url, $args = array() X-Ref |
Send an HTTP request to a URI. Please note: The only URI that are supported in the HTTP Transport implementation are the HTTP and HTTPS protocols. return: array|WP_Error { param: string $url The request URL. param: string|array $args { |
normalize_cookies( $cookies ) X-Ref |
Normalizes cookies for using in Requests. return: WpOrg\Requests\Cookie\Jar Cookie holder object. param: array $cookies Array of cookies to send with the request. |
browser_redirect_compatibility( $location, $headers, $data, &$options, $original ) X-Ref |
No description |
validate_redirects( $location ) X-Ref |
Validate redirected URLs. param: string $location URL to redirect to. |
_get_first_available_transport( $args, $url = null ) X-Ref |
Tests which transports are capable of supporting the request. return: string|false Class name for the first transport that claims to support the request. param: array $args Request arguments. param: string $url URL to request. |
_dispatch_request( $url, $args ) X-Ref |
Dispatches a HTTP request to a supporting transport. Tests each transport in order to find a transport which matches the request arguments. Also caches the transport instance to be used later. The order for requests is cURL, and then PHP Streams. return: array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. param: string $url URL to request. param: array $args Request arguments. |
post( $url, $args = array() X-Ref |
Uses the POST HTTP method. Used for sending data that is expected to be in the body. return: array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. param: string $url The request URL. param: string|array $args Optional. Override the defaults. |
get( $url, $args = array() X-Ref |
Uses the GET HTTP method. Used for sending data that is expected to be in the body. return: array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. param: string $url The request URL. param: string|array $args Optional. Override the defaults. |
head( $url, $args = array() X-Ref |
Uses the HEAD HTTP method. Used for sending data that is expected to be in the body. return: array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. param: string $url The request URL. param: string|array $args Optional. Override the defaults. |
processResponse( $response ) X-Ref |
Parses the responses and splits the parts into headers and body. return: array { param: string $response The full response string. |
processHeaders( $headers, $url = '' ) X-Ref |
Transforms header string into an array. return: array { param: string|array $headers The original headers. If a string is passed, it will be converted param: string $url Optional. The URL that was requested. Default empty. |
buildCookieHeader( &$r ) X-Ref |
Takes the arguments for a ::request() and checks for the cookie array. If it's found, then it upgrades any basic name => value pairs to WP_Http_Cookie instances, which are each parsed into strings and added to the Cookie: header (within the arguments array). Edits the array by reference. param: array $r Full array of args passed into ::request() |
chunkTransferDecode( $body ) X-Ref |
Decodes chunk transfer-encoding, based off the HTTP 1.1 specification. Based off the HTTP http_encoding_dechunk function. return: string Chunked decoded body on success or raw body on failure. param: string $body Body content. |
block_request( $uri ) X-Ref |
Determines whether an HTTP API request to the given URL should be blocked. Those who are behind a proxy and want to prevent access to certain hosts may do so. This will prevent plugins from working and core functionality, if you don't include `api.wordpress.org`. You block external URL requests by defining `WP_HTTP_BLOCK_EXTERNAL` as true in your `wp-config.php` file and this will only allow localhost and your site to make requests. The constant `WP_ACCESSIBLE_HOSTS` will allow additional hosts to go through for requests. The format of the `WP_ACCESSIBLE_HOSTS` constant is a comma separated list of hostnames to allow, wildcard domains are supported, eg `*.wordpress.org` will allow for all subdomains of `wordpress.org` to be contacted. return: bool True to block, false to allow. param: string $uri URI of url. |
parse_url( $url ) X-Ref |
Used as a wrapper for PHP's parse_url() function that handles edgecases in < PHP 5.4.7. return: bool|array False on failure; Array of URL components on success; param: string $url The URL to parse. |
make_absolute_url( $maybe_relative_path, $url ) X-Ref |
Converts a relative URL to an absolute URL relative to a given URL. If an Absolute URL is provided, no processing of that URL is done. return: string An Absolute URL, in a failure condition where the URL cannot be parsed, the relative URL will be returned. param: string $maybe_relative_path The URL which might be relative. param: string $url The URL which $maybe_relative_path is relative to. |
handle_redirects( $url, $args, $response ) X-Ref |
Handles an HTTP redirect and follows it if appropriate. return: array|false|WP_Error An HTTP API response array if the redirect is successfully followed, param: string $url The URL which was requested. param: array $args The arguments which were used to make the request. param: array $response The response of the HTTP request. |
is_ip_address( $maybe_ip ) X-Ref |
Determines if a specified string represents an IP address or not. This function also detects the type of the IP address, returning either '4' or '6' to represent an IPv4 and IPv6 address respectively. This does not verify if the IP is a valid IP, only that it appears to be an IP address. return: int|false Upon success, '4' or '6' to represent an IPv4 or IPv6 address, false upon failure. param: string $maybe_ip A suspected IP address. |
Generated : Sat Nov 23 08:20:01 2024 | Cross-referenced by PHPXref |