WordPress at a glance

wp_remote_retrieve_header() WP 1.0

Retrieve a single header by name from the raw response.

No Hooks.

Return

String. The header value. Empty string on if incorrect parameter given, or if the header doesn't exist.

Usage

wp_remote_retrieve_header( $response, $header );
$response(array) (required)
$header(string) (required)
Header name to retrieve value from.

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

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

	if ( isset( $response['headers'][ $header ] ) ) {
		return $response['headers'][$header];
	}

	return '';
}

Related Functions

From tag: HTTP API (curl remote)

No comments
    Hello, !     Log In . Register