Is there a way to find out HTTP Post parameter names when you don't have the form?

770 views Asked by At

There is a php web page that i want to submit my POST request but i don't know the name of the parameter. Is there a way to find out the name of the parameter that i should submit my values into.

Update: I don't have the form that submit to that page. So i can't use $_POST.

3

There are 3 answers

7
Halcyon On

You can get the names of all passed $_POST parameters with:

$parameter_names = array_keys($_POST);

If you know there is only one parameter, to get the value use:

$value = $_POST[array_keys($_POST)[0]];
2
user3791372 On

If I understand correctly, you want to submit data to a form, but don't know what keys to use to submit. As you know, you need to know them, so find the form on the website, and look at the source code for the name="whatever" parts of the relevant inputs and make a note of the string inside the quotes. Those are your key names.

2
Michael Wagner On

If you want to know the parameters and don't programmatically use them, you can also use print_r($_POST);