WordPress at a glance

wp_remote_retrieve_headers() WP 1.0

Retrieve only the headers from the raw response.

  • See: \Requests_Utility_CaseInsensitiveDictionary
  • Since 4.6.0 Return value changed from an array to an Requests_Utility_CaseInsensitiveDictionary instance.
Is the basis for: wp_get_http_headers()

No Hooks.

Return

Array/\Requests_Utility_CaseInsensitiveDictionary. The headers of the response. Empty array if incorrect parameter given.

Usage

wp_remote_retrieve_headers( $response );
$response(array) (required)
HTTP response.

Code of wp_remote_retrieve_headers: wp-includes/http.php VER 4.9.8

<?php
function wp_remote_retrieve_headers( $response ) {
	if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) {
		return array();
	}

	return $response['headers'];
}

Related Functions

From tag: HTTP API (curl remote)

No comments
    Hello, !     Log In . Register