wp_safe_remote_get() – Retrieve the raw response from a safe HTTP request using the GET method.

You appear to be a bot. Output may be restricted

Description

Retrieve 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 is validated to avoid redirection and request forgery attacks.

Usage

$array|WP_Error = wp_safe_remote_get( $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_get( $url, $args = array() ) {
  $args['reject_unsafe_urls'] = true;
  $http                       = _wp_http_get_object();
  return $http->get( $url, $args );
}
 

 View on GitHub View on Trac