RobAtStackOverflow
RobAtStackOverflow

Reputation: 525

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...

Upvotes: 2

Views: 3014

Answers (2)

Dan
Dan

Reputation: 3870

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;
?>

Upvotes: 2

dynamic
dynamic

Reputation: 48141

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

Upvotes: 7

Related Questions