WordPress at a glance

wp_remote_retrieve_headers() WP 1.0

Retrieve only the headers from the raw response.

Возвращает

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

No Hooks.

Usage

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

Notes

  • See: \Requests_Utility_CaseInsensitiveDictionary

Список изменений

С версии 2.7.0 Введена.
С версии 4.6.0 Return value changed from an array to an Requests_Utility_CaseInsensitiveDictionary instance.

Code of wp_remote_retrieve_headers() WP 5.5.1

wp-includes/http.php
<?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
    Log In . Register