Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Can anyone help me please? I am trying to simulate form submission. This is what I have tried. But the form->click() function does not seem to submit the form. When I try to download a page after that, it still downloads the page that says that I need to submit siteid, username and password.
Thanks.
#!/usr/bin/perl use HTTP::Cookies; use HTML::Form; use LWP; use URI; require 'dumpvar.pl'; my $sId = 'siteID'; my $log = 'username'; my $pswd = 'password'; my $ua = LWP::UserAgent->new(); my $url = 'http://xxx.yyy.html'; my $login_req = HTTP::Request->new(GET => $url); my $login_res = $ua->request($login_req); my $html = $login_res->content; my $form = HTML::Form->parse($html, "http://xxx.yyy.html"); #dumpValue(\$form); $form->value('site', $sId); $form->value('user', $log); $form->value('pass', $pswd); $form->click; $url = 'http://xxx.yyy.html'; $login_req = HTTP::Request->new(GET => $url); $login_res = $ua->request($login_req); print $login_res->content;
Edited 2001-10-18 by Ovid
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with automated form submission
by tomhukins (Curate) on Oct 19, 2001 at 00:04 UTC | |
by Anonymous Monk on Oct 19, 2001 at 00:19 UTC | |
by tomhukins (Curate) on Oct 19, 2001 at 20:09 UTC |