wp_remote_retrieve_body

Retrieve only the body from the raw response.

Description

(string) wp_remote_retrieve_body( (array) $response ); 

Returns (string)

The body of the response. Empty string if no body or incorrect parameter given.

Parameters (1)

0. $response (array)
HTTP response.

Usage

  1. if ( !function_exists( 'wp_remote_retrieve_body' ) ) { 
  2. require_once ABSPATH . WPINC . '/http.php'; 
  3.  
  4. // HTTP response. 
  5. $response = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_remote_retrieve_body($response); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/http.php  
  1. function wp_remote_retrieve_body( $response ) { 
  2. if ( is_wp_error($response) || ! isset($response['body']) ) 
  3. return ''; 
  4.  
  5. return $response['body'];