http://www.perlmonks.org?node_id=985162


in reply to Perl Script to login to a secure WebSite

You are using wrong form name and field names too. Through the same code I was able to login to gmail :
use strict; use warnings; use strict; use WWW::Mechanize; use HTTP::Cookies; my $outfile = "out2.htm"; my $url = "https://accounts.google.com/ServiceLogin?service=mail&passi +ve=true&rm=false&continue=http://mail.google.com/mail/&scc=1&ltmpl=de +fault&ltmplcache=2"; my $username = 'yourgmailid'; my $password = 'yourpasswrd'; my $mech = WWW::Mechanize->new(); $mech->cookie_jar(HTTP::Cookies->new()); $mech->get($url); $mech->form_id('gaia_loginform'); $mech->field("Email", $username); $mech->field("Passwd", $password); $mech->click; my $output_page = $mech->content(); print $output_page; open(OUTFILE, ">$outfile"); binmode(OUTFILE, ":utf8"); print OUTFILE "$output_page"; close(OUTFILE);
I also used print $output_page; to check the contents separately, you can ignore that one.