mak has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

It looks like I am stuck with form parsing. I tackeled down one problem with artura's help. Now I got another one. HTML::form does not seem to parse multiple forms in a html file. The page that I need to login has two forms and it only gets the first one, which isn't the one I want. How would I get all the form in a HTML file? Any suggestions?

Mak

use HTTP::Cookies; use HTML::Form; use LWP; use URI; require 'dumpvar.pl'; my $LOGIN = 'lillyglobal'; # put your login name here my $PASSWD = 'analysis';# password here my $ua = LWP::UserAgent->new(); # Step 1 $ua->agent('Mozilla'); # habit my $url = 'http://www.datamonitor.com/login.asp'; # Step 2 my $login_req = HTTP::Request->new(GET => $url); # Step 2 my $login_res = $ua->request($login_req); # Step 3 my $html = $login_res->content; my $form = HTML::Form->parse($html,'http://www.datamonitor.com/login.a +sp'); # Step 4 dumpValue(\$form); # Step 5 $form->value('un',$LOGIN); # Step 6 $form->value('pw',$PASSWD); # Step 6 my $req = $form->click; # Step 7 my $res = $ua->request($req); # Step 8 my $cookie_jar = HTTP::Cookies->new(); # Step 9 $cookie_jar->extract_cookies($res); # Step 9 my $goto = $res->header('location'); # Step 10 my $new_req = HTTP::Request->new(GET => 'http://www.datamonitor.com/se +cure/listaccpurchases.asp') or die "Can't get $goto: $!\n";; # Step 11 $cookie_jar->add_cookie_header($new_req); # Step 12 my $new_res = $ua->request($new_req); # Step 13 print $new_res->headers_as_string,"\n\n"; open (FH, ">D:\\Mustafa\\Perl\\Code\\dm.html") || die "Can't open file to write\n"; print FH $new_res->content; #if ($new_res->is_success); print $new_res->content,"\n";