#!/usr/bin/perl use WWW::Mechanize; use HTTP::Cookies; my $url = "https://affiliate-program.amazon.com/"; my $appurl = "https://www.amazon.com/gp/bestsellers/videogames"; my $username = 'xxxxx'; my $password = 'xxxxx'; my $mech = WWW::Mechanize->new(autocheck => 1); $mech->cookie_jar(HTTP::Cookies->new()); $mech->get($url); $mech->form_name('sign_in'); $mech->field(email => $username); $mech->field(password => $password); $mech->submit(); my $login_content = $mech->content(); # go to an amazon url $mech->get($appurl); my $app_content = $mech->content(); open(IFP,"> amazontest.html "); print IFP $app_content; close IFP;