in reply to Automating an HTML form submission with only required user info

HTLM::FormParser seems the right module for this problem

From the readme file: This module can be used to parse HTML text for forms. Each type of tag that is commonly found in a form (such as input, select, textarea etc) will trigger callbacks provided at the application level.

The callback routines can then be used to cobble together the URL.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

  • Comment on Re: Automating an HTML form submission with only required user info

Replies are listed 'Best First'.
Re: Re: Automating an HTML form submission with only required user info
by tommyw (Hermit) on Dec 19, 2002 at 10:30 UTC

    HTML::Form is simpler to use for this sort of thing than HTML::FormParser (and comes with LWP, so it's probably more available).

    my $form=HTML::Form->parse($page, $url); $form->find_input('q1')->value($target); return $form->click;
    This will extract the first form from the HTML held in $page ($url is used to resolve relative URLs), and then q1 has its value set to $target. Finally, we return an HTTP::Request object (representing the form submission). If you want to turn this into a URL, then invoke uri_as_string on it.

    --
    Tommy
    Too stupid to live.
    Too stubborn to die.