Page 1 of 1

Retreiving form input parameters

Posted: Thu Jun 03, 2010 8:18 pm
by deviantPsyche
Hello everyone,

I'm trying to retrieve all input fields (or parameters) that are being submitted from a form with a method="post". The form is not located on my server so I can't just use $_POST or $_REQUEST to get those parameters.

When using LiveHttpHeaders firefox addon and submitting an empty form on one of the site, here is the post string it shows:
firstName=&lastName=&gender=F&birthMonth=0&birthDay=0&birthYear=0&country=US&city=&zipCode=&locale=en_US&email=&password=&recaptcha_challenge_field=&recaptcha_response_field=

This string is exactly what I want, it has all the parameters like (firstName, lastName, gender etc....) in the string.

Is it possible to do something like this with php? I already tried curl post without any luck. I have tried posting empty fields from curl but all I can get is an empty string that I'm submitting when I call curl_getinfo() with curl_setopt($curl_handle, CURLINFO_HEADER_OUT, TRUE).

What I don't want is to use regex to match every form on a site (and all the input fields), it would make my life so much easier if I could just parse form action url and then extract all the necessary parameters from it.

I will greatly appreciate any help on this.

Re: Retreiving form input parameters

Posted: Thu Jun 03, 2010 8:55 pm
by phdatabase
Yes. Try this. Load the form into your browser. View the page source and copy it to your editor. Save it locally. Change the action attribute to the php page of your choice where you CAN read the POST array and cookies too. Doesn't work with JavaScript though. But. You can download the JavaScript scripts and reverse engineer those too.

Or go here and follow the directions http://www.phdatabase.com/form_reader.php