[SOLVED]HTTP Request headers.
Posted: Sat Aug 09, 2008 3:39 pm
Hello!
Is there an way to get and turn the HTTP request headers into an associative array, using php? For example, let's say someone makes an HTTP request to somepage.php. The HTTP request looks like so:
Can somepage.php somehow read all the request headers of that HTTP request and turn them into an array? So that I could write something like:
Thanks for reading.
Is there an way to get and turn the HTTP request headers into an associative array, using php? For example, let's say someone makes an HTTP request to somepage.php. The HTTP request looks like so:
Code: Select all
POST somepage.php HTTP/1.1
Host: url.com
From: somewhere.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 12345
body and stuffCode: Select all
if ($headers['From'] == "somewhere.net" && $headers['From'] != "somewhere.com") { }