Retrieves the raw response from a safe HTTP request using the POST method.
Description
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).
See also
- wp_remote_request(): For more information on the response array format.
- WP_Http::request(): For default arguments information.
- wp_http_validate_url(): For more information about how the URL is validated.
Parameters
$url
stringrequired- URL to retrieve.
$args
arrayoptional- Request arguments.
See WP_Http::request() for information on accepted arguments.Default:
array()
Source
function wp_safe_remote_post( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true;
$http = _wp_http_get_object();
return $http->post( $url, $args );
}
Changelog
Version | Description |
---|---|
3.6.0 | Introduced. |
See also https://developer.wordpress.org/reference/functions/wp_remote_post/