Re: Are all HTTP headers registered in SERVER?
| From: | Matthew Weier O'Phinney | Date: | Fri, 09 Sep 2011 15:56:46 +0000 |
| Subject: | Re: Are all HTTP headers registered in SERVER? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-55334@lists.php.net to get a copy of this message | ||
On 2011-09-08, Karoly Negyesi <karoly@negyesi.net> wrote:
> It seems to be the case but this is not documented anywhere on
> php.net. Instead
> http://php.net/manual/en/function.apache-request-headers.php
> say "You
> can also get at the value of the common CGI variables by reading them
> from the environment".
>
> This comment
> http://www.php.net/manual/en/reserved.variables.server.php#87195
> from 2008 concurs. Zend and Symphony both seems to be happy to read
> even X- custom headers from SERVER without bothering with
> apace_request_headers() or anything like that.
The reason is that this is the only truly portable way to get the headers, and
it's easier to write a single implementation rather than multiple ones.
That said, I'd really love to have a method in PHP for retrieving request
headers, either singly or as a list. Having to parse through $_SERVER has always
felt hackish.
--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc