#!C:\\Programme\\Perl\\bin use strict; use warnings; use WWW::Mechanize; use HTTP::Cookies; my $outfile = "out.htm"; my $url = "http://testhost.com/mainpage"; my $username = "test"; my $password = "testpw"; my $mech = WWW::Mechanize->new(); my $formname = "form1"; $mech->cookie_jar(HTTP::Cookies->new()); $mech->get($url); $mech->form_name($formname); $mech->field(userName => $username); $mech->field(password => $password); $mech->click(); my $output_page = $mech->content(); open(OUTFILE, ">$outfile"); print OUTFILE "$output_page"; close(OUTFILE);