Automatically retreiving all form input field names

Discussion in 'PHP' started by deviantPsyche, Jun 3, 2010.

  1. #1
    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.
     
    deviantPsyche, Jun 3, 2010 IP
  2. Visin7

    Visin7 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Does the form on another server communicate with one of your files already?
     
    Visin7, Jun 4, 2010 IP
  3. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #3
    What do you try to do?

    Do you just want to get the field names or the actual data??
     
    stephan2307, Jun 4, 2010 IP