[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
HTTP API: WP_Http class
File Size: | 1099 lines (40 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 1 file wp-includes/class-requests.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. since: 2.7.0 param: string $url The request URL. param: string|array $args { return: array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. |
normalize_cookies( $cookies ) X-Ref |
Normalizes cookies for using in Requests. since: 4.6.0 param: array $cookies Array of cookies to send with the request. return: Requests_Cookie_Jar Cookie holder object. |
browser_redirect_compatibility( $location, $headers, $data, &$options, $original ) X-Ref |
No description |
validate_redirects( $location ) X-Ref |
Validate redirected URLs. since: 4.7.5 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. since: 3.2.0 param: array $args Request arguments. param: string $url URL to request. return: string|false Class name for the first transport that claims to support the 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. since: 3.2.0 param: string $url URL to request. param: array $args Request arguments. return: array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. |
post( $url, $args = array() X-Ref |
Uses the POST HTTP method. Used for sending data that is expected to be in the body. since: 2.7.0 param: string $url The request URL. param: string|array $args Optional. Override the defaults. return: array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. |
get( $url, $args = array() X-Ref |
Uses the GET HTTP method. Used for sending data that is expected to be in the body. since: 2.7.0 param: string $url The request URL. param: string|array $args Optional. Override the defaults. return: array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. |
head( $url, $args = array() X-Ref |
Uses the HEAD HTTP method. Used for sending data that is expected to be in the body. since: 2.7.0 param: string $url The request URL. param: string|array $args Optional. Override the defaults. return: array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. |
processResponse( $response ) X-Ref |
Parses the responses and splits the parts into headers and body. since: 2.7.0 param: string $response The full response string. return: array { |
processHeaders( $headers, $url = '' ) X-Ref |
Transforms header string into an array. since: 2.7.0 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. return: array { |
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. since: 2.8.0 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. since: 2.7.0 param: string $body Body content. return: string Chunked decoded body on success or raw body on failure. |
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. since: 2.8.0 param: string $uri URI of url. return: bool True to block, false to allow. |
parse_url( $url ) X-Ref |
Used as a wrapper for PHP's parse_url() function that handles edgecases in < PHP 5.4.7. param: string $url The URL to parse. return: bool|array False on failure; Array of URL components on success; |
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. since: 3.4.0 param: string $maybe_relative_path The URL which might be relative. param: string $url The URL which $maybe_relative_path is relative to. return: string An Absolute URL, in a failure condition where the URL cannot be parsed, the relative URL will be returned. |
handle_redirects( $url, $args, $response ) X-Ref |
Handles an HTTP redirect and follows it if appropriate. since: 3.7.0 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. return: array|false|WP_Error An HTTP API response array if the redirect is successfully followed, |
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 a 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. since: 3.7.0 param: string $maybe_ip A suspected IP address. return: int|false Upon success, '4' or '6' to represent a IPv4 or IPv6 address, false upon failure |
Generated: Sun Oct 13 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |