PHP - Intercept POST requests
I was wondering if anyone could help me solve how to view $_POST
requests.
What i want to do, is check all $_POST
requests, not just certain ones like $_POST['name'], $_POST['post']
etc, I'd like to check every post, without being able to know the name of each POST request.
Here is what i've tried (snippet):
foreach ($_POST as $pst)
{
echo $pst;
}
//And tried the above for 开发者_如何转开发GET too. (but the GET I've manged to working.)
I've also tried many others, that i can think off an can come to no resolution...
You used the right solution
foreach($_POST as $key=>$value){
//> do your operation here
echo $key.': '.$value;
}
You can use $key
to get the param name
If you're just looking to output the posts so you can see them to troubleshoot something then i'd use something like this:
<?php
echo "<pre>\n";
print_r($_POST);
echo "</pre>\n";
exit;
?>
精彩评论