WordPress at a glance
Home All Function Functions APIs HTTP API

wp_get_http_headers() WP 1.0

Retrieve HTTP Headers from URL.

No Hooks.

Return

true/false/String. False on failure, headers on success.

Usage

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

Code of wp get http headers: wp-includes/functions.php VER 5.1.1

<?php
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 );
}

Related Functions

From tag: HTTP API (curl remote)

No comments
    Hello, !     Log In . Register