in reply to What's the easiest way to have perl fill in a web form & submit it?

All this and more is possible, using the fabulous CPAN module WWW::Mechanize. You will have to look at the target page sources to program the field names, etc. but it's all pretty straight forward. Examples are available at WWW::Mechanize::Examples and we can certainly help you debug once you've started.
  • Comment on Re: What's the easiest way to have perl fill in a web form & submit it?

Replies are listed 'Best First'.
Re^2: What's the easiest way to have perl fill in a web form & submit it?
by jdlev (Scribe) on Feb 08, 2010 at 20:37 UTC
    Thanks for the help! Mechanize looks like a great pm! I've hit a big snag I think. I can't get Mech to recognize the form. In the web page source code, there is no form name. They are using javascript to verify the data on the form for the login page. Perl can't find the form for whatever reason. So what are my options?

    Also, what's an easy way to see if the program successfully made it past the login page and got to the next page?

    I love it when a program comes together - jdhannibal
      If the web page in question relies heavily on JavaScript, then you can't directly use Mechanize as it doesn't include a JavaScript engine - see WWW::Mechanize::FAQ. There are a couple of alternatives available. You might be able to use Win32::IE::Mechanize or Mozilla::Mechanize, which are supposed to offer external control over your browser. I've never used either, though it seems Win32::IE::Mechanize is better developed and tested. A more roll-you-own solution would use JavaScript::SpiderMonkey, but that's getting pretty hairy. Another choice is if figuring out how the page processes your userid and password and just crafting your own query string - I'd probably take this approach.

      Determining success should be as simple as examining the content of the new page.

      Have you looked at the WWW::Mechanize documentation? It shows the ways you can get at the ->content of the page.