getallheaders

getallheaders -- Fetch all HTTP request headers

Description

array getallheaders(void);

This function returns an associative array of all the HTTP headers in the current request.

Example 1. GetAllHeaders() Example

$headers = getallheaders();
while (list($header, $value) = each($headers)) {
    echo "$header: $value<br>\n";
}
This example will display all the request headers for the current request.

Note: GetAllHeaders() is currently only supported when PHP runs as an Apache module.