After searching a little bit for a simple way to read the request parameters sent to the server, I normally found references telling people to use the apache_request_headers() or the getAllHeaders() (which is actually a wrapper for the previous one) function, but these will only work if you are running php as an apache module. Well, this is not the case for me, as I use Locaweb (a famous hosting service in Brazil).
The snippet below should work on every case, as it uses server information which is available via a $_SERVER variable.
<?php
echo "<h3>Request Content</h3>";
foreach($_SERVER as $i=>$val) {
if ((strpos($i, 'HTTP_') === 0) || ((strpos($i, 'CONTENT_') === 0))) {
echo "$i: $val <br />\n";
}
}
?>
Comments
Post new comment