Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Getting all the parameters of CGI request

by drblove27 (Sexton)
on Feb 02, 2010 at 19:19 UTC ( #821009=perlquestion: print w/replies, xml ) Need Help??
drblove27 has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am sure there is a simple command for this, but my google-fu is failing me. I would like to write a perl script that does a LWP request on a cgi page. To do so, I need the parameters, and sloshing through the HTML to figure out the parameters is hurting my head. Is there a simple command where I can feed a url to it, and it will spit out all the possible parameters that can be passed for the request?

Specifically I am looking to script this site:

Getting the check boxes and input sequence.

Thanks in advance!

Here is the initial code, that posts the results on the page, but does not submit them:

Updated with failed code

Rather I should say that the result of this file, is the original webpage with the variables as given by the code, but the code does not press the "Pick Primers" button....


Replies are listed 'Best First'.
Re: Getting all the parameters of CGI request
by trwww (Priest) on Feb 02, 2010 at 19:47 UTC

    Perhaps WWW::Mechanize::Shell is what you are looking for? For example after fetching the page the forms command lists all forms and fields:

    $ perl -MWWW::Mechanize::Shell -eshell (no url)>get Retrieving> forms Form [1] POST (multipart/form-data) [mainForm] ... snip list of fields and default values where relevant ...
Re: Getting all the parameters of CGI request
by jettero (Monsignor) on Feb 02, 2010 at 19:25 UTC
    It may not list out the params, but it sure will help filling out the form: WWW::Mechanize. Most of the values will have defaults, so you'll only have to set one or two of them and you're done.


      It may not list out the params,

      Sure it does. $mech->forms gets you the forms, and $form->inputs gets you a form's inputs.

Re: Getting all the parameters of CGI request
by holli (Monsignor) on Feb 03, 2010 at 11:38 UTC
    Get Firefox and the Firebug extension.


    You can lead your users to water, but alas, you cannot drown them.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://821009]
Approved by jettero
Front-paged by redgreen
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2017-07-28 13:41 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (429 votes). Check out past polls.