wp_remote_retrieve_headers

Retrieve only the headers from the raw response.

Description

(array|Requests_Utility_CaseInsensitiveDictionary) wp_remote_retrieve_headers( (array) $response ); 

Returns (array|Requests_Utility_CaseInsensitiveDictionary)

The headers of the response. Empty array if incorrect parameter given.

Parameters (1)

0. $response (array)
HTTP response.

Usage

  1. if ( !function_exists( 'wp_remote_retrieve_headers' ) ) { 
  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_headers($response); 
  9.  

Defined (1)

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

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