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&passive=true&rm=false&continue=http://mail.google.com/mail/&scc=1<mpl=default<mplcache=2"; my $username = ""; my $password = ""; my $mech = WWW::Mechanize->new(); $mech->cookie_jar(HTTP::Cookies->new()); $mech->get($url); $mech->form_name('login_form'); $mech->field("Username", $username); $mech->field("Password", $password); $mech->submit_form(form_number => 1); my $output_page = $mech->content(); open(OUTFILE, ">$outfile"); binmode(OUTFILE, ":utf8"); print OUTFILE "$output_page"; close(OUTFILE);