Page 1 of 1

Assigning HTTP Request Variables to PHP Variables

Posted: Tue Sep 22, 2009 4:37 pm
by tangoking
As the title implies, is it possible to grab HTTP request variables and assign them to PHP variables? I envision something like this:

1. HTTP request sent to http://www.mypage.com/index.php
2. HTTP request includes value pairs, such as "Accept," "Accept-Charset," "Referer" (see full list at http://en.wikipedia.org/wiki/List_of_HTTP_headers)
3. index.php will include code to grab each of these pairs; pseudocoded something like this:

Code: Select all

$accept = $_HTTP_REQUEST['Accept'];
$accept_charset = $_HTTP_REQUEST['Accept-Charset'];
$referrer = $_HTTP_REQUEST['Accept-Referer'];
etc..

While we're at it, is it possible to do the same thing with HTTP Responses?

tyvm!

Re: Assigning HTTP Request Variables to PHP Variables

Posted: Tue Sep 22, 2009 4:49 pm
by jackpf
apache_request_headers()
and
get_headers()


;)