[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Core HTTP Request API Standardizes the HTTP requests for WordPress. Handles cookies, gzip encoding and decoding, chunk decoding, if HTTP 1.1 and various other difficult HTTP protocol implementations.
File Size: | 802 lines (25 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
_wp_http_get_object() X-Ref |
Returns the initialized WP_Http Object return: WP_Http HTTP Transport object. |
wp_safe_remote_request( $url, $args = array() X-Ref |
Retrieves the raw response from a safe HTTP request. This function is ideal when the HTTP request is being made to an arbitrary URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() to avoid Server Side Request Forgery attacks (SSRF). return: array|WP_Error The response or WP_Error on failure. param: string $url URL to retrieve. param: array $args Optional. Request arguments. Default empty array. |
wp_safe_remote_get( $url, $args = array() X-Ref |
Retrieves the raw response from a safe HTTP request using the GET method. This function is ideal when the HTTP request is being made to an arbitrary URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() to avoid Server Side Request Forgery attacks (SSRF). return: array|WP_Error The response or WP_Error on failure. param: string $url URL to retrieve. param: array $args Optional. Request arguments. Default empty array. |
wp_safe_remote_post( $url, $args = array() X-Ref |
Retrieves the raw response from a safe HTTP request using the POST method. This function is ideal when the HTTP request is being made to an arbitrary URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() to avoid Server Side Request Forgery attacks (SSRF). return: array|WP_Error The response or WP_Error on failure. param: string $url URL to retrieve. param: array $args Optional. Request arguments. Default empty array. |
wp_safe_remote_head( $url, $args = array() X-Ref |
Retrieves the raw response from a safe HTTP request using the HEAD method. This function is ideal when the HTTP request is being made to an arbitrary URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() to avoid Server Side Request Forgery attacks (SSRF). return: array|WP_Error The response or WP_Error on failure. param: string $url URL to retrieve. param: array $args Optional. Request arguments. Default empty array. |
wp_remote_request( $url, $args = array() X-Ref |
Performs an HTTP request and returns its response. There are other API functions available which abstract away the HTTP method: - Default 'GET' for wp_remote_get() - Default 'POST' for wp_remote_post() - Default 'HEAD' for wp_remote_head() return: array|WP_Error The response array or a WP_Error on failure. param: string $url URL to retrieve. param: array $args Optional. Request arguments. Default empty array. |
wp_remote_get( $url, $args = array() X-Ref |
Performs an HTTP request using the GET method and returns its response. return: array|WP_Error The response or WP_Error on failure. param: string $url URL to retrieve. param: array $args Optional. Request arguments. Default empty array. |
wp_remote_post( $url, $args = array() X-Ref |
Performs an HTTP request using the POST method and returns its response. return: array|WP_Error The response or WP_Error on failure. param: string $url URL to retrieve. param: array $args Optional. Request arguments. Default empty array. |
wp_remote_head( $url, $args = array() X-Ref |
Performs an HTTP request using the HEAD method and returns its response. return: array|WP_Error The response or WP_Error on failure. param: string $url URL to retrieve. param: array $args Optional. Request arguments. Default empty array. |
wp_remote_retrieve_headers( $response ) X-Ref |
Retrieves only the headers from the raw response. return: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array The headers of the response, or empty array param: array|WP_Error $response HTTP response. |
wp_remote_retrieve_header( $response, $header ) X-Ref |
Retrieves a single header by name from the raw response. return: array|string The header(s) value(s). Array if multiple headers with the same name are retrieved. param: array|WP_Error $response HTTP response. param: string $header Header name to retrieve value from. |
wp_remote_retrieve_response_code( $response ) X-Ref |
Retrieves only the response code from the raw response. Will return an empty string if incorrect parameter value is given. return: int|string The response code as an integer. Empty string if incorrect parameter given. param: array|WP_Error $response HTTP response. |
wp_remote_retrieve_response_message( $response ) X-Ref |
Retrieves only the response message from the raw response. Will return an empty string if incorrect parameter value is given. return: string The response message. Empty string if incorrect parameter given. param: array|WP_Error $response HTTP response. |
wp_remote_retrieve_body( $response ) X-Ref |
Retrieves only the body from the raw response. return: string The body of the response. Empty string if no body or incorrect parameter given. param: array|WP_Error $response HTTP response. |
wp_remote_retrieve_cookies( $response ) X-Ref |
Retrieves only the cookies from the raw response. return: WP_Http_Cookie[] An array of `WP_Http_Cookie` objects from the response. param: array|WP_Error $response HTTP response. |
wp_remote_retrieve_cookie( $response, $name ) X-Ref |
Retrieves a single cookie by name from the raw response. return: WP_Http_Cookie|string The `WP_Http_Cookie` object, or empty string param: array|WP_Error $response HTTP response. param: string $name The name of the cookie to retrieve. |
wp_remote_retrieve_cookie_value( $response, $name ) X-Ref |
Retrieves a single cookie's value by name from the raw response. return: string The value of the cookie, or empty string param: array|WP_Error $response HTTP response. param: string $name The name of the cookie to retrieve. |
wp_http_supports( $capabilities = array() X-Ref |
Determines if there is an HTTP Transport that can process this request. return: bool param: array $capabilities Array of capabilities to test or a wp_remote_request() $args array. param: string $url Optional. If given, will check if the URL requires SSL and adds |
get_http_origin() X-Ref |
Gets the HTTP Origin of the current request. return: string URL of the origin. Empty string if no origin. |
get_allowed_http_origins() X-Ref |
Retrieves list of allowed HTTP origins. return: string[] Array of origin URLs. |
is_allowed_http_origin( $origin = null ) X-Ref |
Determines if the HTTP origin is an authorized one. return: string Origin URL if allowed, empty string if not. param: string|null $origin Origin URL. If not provided, the value of get_http_origin() is used. |
send_origin_headers() X-Ref |
Sends Access-Control-Allow-Origin and related headers if the current request is from an allowed origin. If the request is an OPTIONS request, the script exits with either access control headers sent, or a 403 response if the origin is not allowed. For other request methods, you will receive a return value. return: string|false Returns the origin URL if headers are sent. Returns false |
wp_http_validate_url( $url ) X-Ref |
Validates a URL for safe use in the HTTP API. Examples of URLs that are considered unsafe: - ftp://example.com/caniload.php - Invalid protocol - only http and https are allowed. - http:///example.com/caniload.php - Malformed URL. - http://user:pass@example.com/caniload.php - Login information. - http://example.invalid/caniload.php - Invalid hostname, as the IP cannot be looked up in DNS. Examples of URLs that are considered unsafe by default: - http://192.168.0.1/caniload.php - IPs from LAN networks. This can be changed with the {@see 'http_request_host_is_external'} filter. - http://198.143.164.252:81/caniload.php - By default, only 80, 443, and 8080 ports are allowed. This can be changed with the {@see 'http_allowed_safe_ports'} filter. return: string|false URL or false on failure. param: string $url Request URL. |
allowed_http_request_hosts( $is_external, $host ) X-Ref |
Marks allowed redirect hosts safe for HTTP requests as well. Attached to the {@see 'http_request_host_is_external'} filter. return: bool param: bool $is_external param: string $host |
ms_allowed_http_request_hosts( $is_external, $host ) X-Ref |
Adds any domain in a multisite installation for safe HTTP requests to the allowed list. Attached to the {@see 'http_request_host_is_external'} filter. return: bool param: bool $is_external param: string $host |
wp_parse_url( $url, $component = -1 ) X-Ref |
A wrapper for PHP's parse_url() function that handles consistency in the return values across PHP versions. Across various PHP versions, schemeless URLs containing a ":" in the query are being handled inconsistently. This function works around those differences. return: mixed False on parse failure; Array of URL components on success; param: string $url The URL to parse. param: int $component The specific component to retrieve. Use one of the PHP |
_get_component_from_parsed_url_array( $url_parts, $component = -1 ) X-Ref |
Retrieves a specific component from a parsed URL array. return: mixed False on parse failure; Array of URL components on success; param: array|false $url_parts The parsed URL. Can be false if the URL failed to parse. param: int $component The specific component to retrieve. Use one of the PHP |
_wp_translate_php_url_constant_to_key( $constant ) X-Ref |
Translates a PHP_URL_* constant to the named array keys PHP uses. return: string|false The named key or false. param: int $constant PHP_URL_* constant. |
Generated : Sat Dec 21 08:20:01 2024 | Cross-referenced by PHPXref |