WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp remote retrieve header

Description

Retrieve a single header by name from the raw response.

Usage

 <?php wp_remote_retrieve_header$response$header ); ?> 

Parameters

$response
(array) (required) no description
Default: None
$header
(string) (required) Header name to retrieve value from.
Default: None

Return Values

(string) 
The header value. Empty string on if incorrect parameter given, or if the header doesnt exist.

Examples

$response = wp_remote_get('http://www.foo.com/file.txt');
$last_modified = wp_remote_retrieve_header( $response, 'last-modified' );

$last_modified will contain the value of the HTTP header last-modified

Change Log

Since: 2.7.0

Source File

wp_remote_retrieve_header() is located in wp-includes/http.php