Home > PHP > Function > URLs > get_headers()

get_headers()

get_headers - Fetches all the headers sent by the server in response to a HTTP request

Syntax

array get_headers (string $url, int $format)

Arguments

  • url - The target URL.
  • format - If the optional format parameter is set to non-zero, get_headers() parses the response and sets the array\'s keys.

Description

get_headers() returns an array with the headers sent by the server in response to a HTTP request.

Version

PHP 5

Return value

Returns an indexed or associative array with the headers, or FALSE on failure.