WP_Http
- Since
- 2.7.0
- Source
wp-includes/class-wp-http.php:33
Core class used for managing HTTP transports and making HTTP requests.
Description
This class is used to consistently make outgoing HTTP requests easy for developers while still being compatible with the many PHP configurations under which WordPress runs.
Debugging includes several actions, which pass different variables for debugging the HTTP API.
Compatibility
- WordPress
- since 2.7.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 17
Every hook that fires from inside WP_Http, in the order it appears in the class, grouped by the method that fires it.
WP_Http::request()
- apply_filters( http_request_timeout )filter line 181
- apply_filters( http_request_redirection_count )filter line 191
- apply_filters( http_request_version )filter line 201
- apply_filters( http_headers_useragent )filter line 211
- apply_filters( http_request_reject_unsafe_urls )filter line 221
- apply_filters( http_request_args )filter line 252
- apply_filters( pre_http_request )filter line 277
- do_action( http_api_debug )action line 297
- do_action( http_api_debug )action line 305
- do_action( http_api_debug )action line 322
- apply_filters( https_ssl_verify )filter line 398
- do_action( http_api_debug )action line 441
- apply_filters( http_response )filter line 468
WP_Http::_get_first_available_transport()
- do_action( http_api_transports )filter_deprecated line 561
WP_Http::_dispatch_request()
- do_action( http_api_debug )action line 614
- apply_filters( http_response )filter line 621
Methods · 18
- request()Send an HTTP request to a URI.
- normalize_cookies()Normalizes cookies for using in Requests.
- browser_redirect_compatibility()Match redirect behavior to browser handling.
- validate_redirects()Validate redirected URLs.
- _get_first_available_transport()Tests which transports are capable of supporting the request.
- _dispatch_request()Dispatches a HTTP request to a supporting transport.
- post()Uses the POST HTTP method.
- get()Uses the GET HTTP method.
- head()Uses the HEAD HTTP method.
- processResponse()Parses the responses and splits the parts into headers and body.
- processHeaders()Transforms header string into an array.
- buildCookieHeader()Takes the arguments for a ::request() and checks for the cookie array.
- chunkTransferDecode()Decodes chunk transfer-encoding, based off the HTTP 1.1 specification.
- block_request()Determines whether an HTTP API request to the given URL should be blocked.
- parse_url()Used as a wrapper for PHP's parse_url() function that handles edgecases in < PHP 5.4.7.
- make_absolute_url()Converts a relative URL to an absolute URL relative to a given URL.
- handle_redirects()Handles an HTTP redirect and follows it if appropriate.
- is_ip_address()Determines if a specified string represents an IP address or not.
Changelog
Introduced in 2.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/class-wp-http.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.