#!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $mech = WWW::Mechanize->new( stack_depth => 1, timeout => 180, autocheck => 1 ); # Part 1 my $url = 'http://somewhere.tld'; $mech->get($url); __END__ # Part 2 # my $username = ''; my $password = ''; $mech->form_name('loginform'); $mech->field(login => $username); $mech->field(passwd => $password); $mech->click(); # Which button? # Part 3 my $outpage = $mech->content(); my $outfile = 'output.html'; # Always use the three argument form of open open(OUTFILE, ">", $outfile) or die $!; print OUTFILE "$outpage"; close(OUTFILE) or die $!;