#! /usr/bin/perl #needs javascript navigation capability around line 34 -date 4/17/13 use WWW::Mechanize; use LWP::UserAgent; #This block of code follows from the CAPS homepage to the Account Inquiries link my $mech = WWW::Mechanize->new(); my $url = "https://gateway.usps.com/bcg/login.htm"; $mech->get($url); if ($mech->success()){ print "Successful Connection\n"; } else { print "Not a successful connection\n"; } #This block of code is intended to fill in the required forms $mech->get($url); my $usr = "asdf"; #marked out for post my $pw = "asdffgg"; $mech->form_number(1); $mech->field( "login_name", $usr); $mech->form_number(2); $mech->field("user_password", $pw); $mech->click(); #follow link to dashboard $mech->follow_link( url=> 'https://prodp1.usps.com/adminweb/view.htm?requestPage=P1DASHBOARD'); $mech->follow_link( url=> 'https://www.uspspostalone.com/CIMweb/owner.do?group_name=Mailer&landing=Dashboard'); print $mech->content(); #my $ua = LWP::UserAgent->new(); #my $response = $ua->get('https://prodp1.usps.com/adminweb/view.htm?requestPage=P1DASHBOARD'); #my $response2 = $ua->get('https://www.uspspostalone.com/CIMweb/owner.do?group_name=Mailer&landing=Dashboard'); #my $response3 = $ua->get('https://www.uspspostalone.com/CIMweb/owner.do?group_name=Mailer&landing=MailingReports'); #my $response4 = $ua->get('https://www.uspspostalone.com/fullservice/dashboard.html?reset=true'); #my $response5 = $ua->get ('https://www.uspspostalone.com/fullservice/downloadAcsReportSearch.html'); #the last link above is the page I need to end up at. I commented this out for now