PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

virtual> <ebcdic2ascii
Last updated: Fri, 22 Aug 2008

view this page in

getallheaders

(PHP 4, PHP 5)

getallheadersRecuperar todas las cabeceras de petición HTTP

Descripción

array getallheaders ( void )

Recupera todas las cabeceras HTTP de la petición actual.

Esta función es un alias de apache_request_headers(). Por favor lea la documentación de apache_request_headers() para más información sobre cómo trabaja esta función.

This function is only supported when PHP is installed as an Apache module.

Valores retornados

Una matriz asociativa de todas las cabeceras HTTP en la petición actual, o FALSE en caso de fallo.

Registro de cambios

Versión Descripción
4.3.0 Se convierte en un alias de apache_request_headers(). Básicamente, fue renombrada. Esto se debe a que esta función solo trabaja con Apache.

Ejemplos

Example #1 Ejemplo de getallheaders()

<?php

foreach (getallheaders() as $nombre => $valor) {
    echo 
"$nombre: $valor\n";
}

?>

Notes

Note: A partir de PHP 4.3.3 se puede usar tambien esta funcion con el modulo de servidor NSAPI de los servidores web, Netscape/iPlanet/SunONE.



add a note add a note User Contributed Notes
getallheaders
joyview at gmail dot com
06-Jul-2008 05:52
it could be useful if you using nginx instead of apache

if (!function_exists('getallheaders'))
{
    function getallheaders()
    {
       foreach ($_SERVER as $name => $value)
       {
           if (substr($name, 0, 5) == 'HTTP_')
           {
               $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
           }
       }
       return $headers;
    }
}
lorro at lorro dot hu
19-Apr-2005 03:25
Beware that RFC2616 (HTTP/1.1) defines header fields as case-insensitive entities. Therefore, array keys of getallheaders() should be converted first to lower- or uppercase and processed such.

virtual> <ebcdic2ascii
Last updated: Fri, 22 Aug 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites