This page redirects to an external site: https://developer.wordpress.org/reference/functions/wp_remote_retrieve_body/
Retrieve only the body from the raw response.
<code style="color: #000000"><span style="color: #0000BB"><?php $body </span><span style="color: #007700">= </span><span style="color: #0000BB">wp_remote_retrieve_body</span><span style="color: #007700">(</span><span style="color: #0000BB">$response</span><span style="color: #007700">); </span><span style="color: #0000BB">?></span></code>
Retrieving data from a JSON API:
$url = 'http://example.org/api'; $response = wp_remote_get( esc_url_raw( $url ) ); /* Will result in $api_response being an array of data, parsed from the JSON response of the API listed above */ $api_response = json_decode( wp_remote_retrieve_body( $response ), true );
Since: 2.7.0
wp_remote_retrieve_body() is located in wp-includes/http.php