wp_safe_remote_request() – Retrieve the raw response from a safe HTTP request.
You appear to be a bot. Output may be restricted
Description
Retrieve 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 is validated to avoid redirection and request forgery attacks.
Usage
$array|WP_Error = wp_safe_remote_request( $url, $args );
Parameters
- $url
- ( string ) required – URL to retrieve.
- $args
- ( array ) optional – Optional. Request arguments. Default empty array. See WP_Http::request() for information on accepted arguments.
Returns
array|WP_Error The response or WP_Error on failure.
Source
File name: wordpress/wp-includes/http.php
Lines:
1 to 5 of 5
function wp_safe_remote_request( $url, $args = array() ) { $args['reject_unsafe_urls'] = true; $http = _wp_http_get_object(); return $http->request( $url, $args ); }