WordPress at Your Fingertips

wp_get_http_headers() WP 1.0

Retrieve HTTP Headers from URL.

No Hooks.

Return

String|false. Headers on success, false on failure.

Usage

wp_get_http_headers( $url, $deprecated );
$url(string) (required)
URL to retrieve HTTP headers from.
$deprecated(true|false)
Not Used.
Default: false

Changelog

Since 1.5.1 Introduced.

Code of wp_get_http_headers() WP 5.8.1

function wp_get_http_headers( $url, $deprecated = false ) {
	if ( ! empty( $deprecated ) ) {
		_deprecated_argument( __FUNCTION__, '2.7.0' );
	}

	$response = wp_safe_remote_head( $url );

	if ( is_wp_error( $response ) ) {
		return false;
	}

	return wp_remote_retrieve_headers( $response );
}

HTTP API (curl remote)

No comments
    Log In