in reply to trouble filling out HTML form

Try WWW::Mechanize. In looking at the form, you would use the following code:

use WWW::Mechanize; my $browser = WWW::Mechanize->new; $browser->get($url); $browser->submit_form( form_name => 'logon', fields => { UserID => $user, Password => $pass });

I noticed that their HTML is wrong. They forgot to specify the type for the UserID input box. I don't know if that will cause a problem.

Cheers,
Ovid

New address of my CGI Course.

Replies are listed 'Best First'.
Re: Re: trouble filling out HTML form
by tachyon (Chancellor) on Oct 21, 2003 at 00:21 UTC

    Note that with Ovids solution you *may* have to parse out and include some or all of the hidden fields in the form as well as adding the user/pass fields, otherwise the login may fail.

    Additionally the login STATE may be maintained by hidden fields in subsequent pages (you need to parse them out and add them into subsequent post login requests) or a SESSION COOKIE which you need to accept, save and pass with each post login request.

    They forgot to specify the type for the UserID input box

    You don't have to, the practical default is text

    If you think about the transaction there is no data passed from browser to server about the type of field so provided the browser will render it you have no issue in the real world.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Thanks very much, tachyon and Ovid. Mech is in fact much better suited to this task than the old HTTP::Request and HTML::TreeBuilder modules I was using before. You perl monks are wise indeed.