Jump to content

PHP Question


jhecht

Recommended Posts

Well I'm building a forum system that is made in AJAX, but is also backwards compatible for browsers that have JS disabled. Now, in my previous version of PHP, i would set the header X-Requested-with, and PHP would take that header and make it a part of the server variable, allowing me to access it through $_SERVER['X_REQUESTED_WITH']. Only problem as of now is that it doesn't seem to do that in the newer version. I've read around the PHP documentation, and found no function that gets the current headers being sent. If i perhaps missed it, then please just show me the page and I can take it from there, but if there isn't a function, as i assume there isn't, can someone with perhaps a better knowledge of PHP/Headers help me out a bit here? I'm stumped and haven't been able to figure this out for almost 2 days.Thanks for any help in advanced.

Link to comment
Share on other sites

You can check these pages to see what it is you wanthttp://us2.php.net/manual/en/function.headers-sent.php - Checks to see if headers have been senthttp://us2.php.net/manual/en/function.headers-list.php - Returns list of response headers in an indexed arrayMust have PHP installed as an Apache Modulehttp://us2.php.net/manual/en/function.apac...est-headers.php - Returns requested headers in an associative arrayhttp://us2.php.net/manual/en/function.apac...nse-headers.php - Returns response headers in an associative array

Link to comment
Share on other sites

Allright, that does it. The function that did it for me was apache_request_headers(). Thanks, you're a life saver.

Link to comment
Share on other sites

If the application needs to be portable from outside of Apache (or work as CGI instead of just an Apache module), you can also usehttp_get_request_headers(). THAT however requires the PECL HTTP extension instead. There seems to be no built in function to do what you're asking.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...