##
#!perl
# Automated navigation through web pages
use strict;
use warnings;
use WWW::Mechanize;
my $testpage='https://www.openinvoice.com/docp/login/login.jsp';
my $teststring = 'Oilfield Commerce Platform (TM) Login';
$testpage = 'http://www.openinvoice.com';
$teststring = 'login now';
my $a = WWW::Mechanize->new(autocheck => 1,
agent => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461)',
keep_alive=> 1);
$a->proxy(['http', 'https'], 'http://www-proxy:8080/proxy.pac');
my @silly_headers = ('Accept-Language' => 'en-us',
'Accept-Encoding' => 'gzip, deflate',
'Accept' => '*/*');
$a->get($testpage, @silly_headers);
$a->success() or die "Failed to get $testpage: ".$a->status()."\n".$a->res()->as_string()."\n";
my $link = $a->find_link( text => 'login now.' )
or do {
warn "Did not find link\n";
warn "Link: ". $_->[1] .' -> '. $_->[0] ."\n" for $a->links();
};
#use Data::Dumper;
#die Dumper($link), "\n";
$a->get($link->[0], @silly_headers);
$a->success() or warn "Followed link to ", $a->base, "\n";
$a->success() or die "Failed to get ".($a->base).': '.$a->res()->as_string()."\n";
print "Page is ", $a->content, "\n";
####
Followed link to https://www.openinvoice.com/docp/corp/main/login
Failed to get https://www.openinvoice.com/docp/corp/main/login: HTTP/1.0 500 (Internal Server Error) Error from proxy
Content-Type: text/html
Client-Date: Fri, 28 Nov 2003 18:05:11 GMT
Client-Peer: 148.89.144.220:8080
Client-Response-Num: 1
Mime-Version: 1.0
Proxy-Agent: iPlanet-Web-Proxy-Server/3.6
Title: Error
Error
Error
The requested item could not be loaded by the proxy.
The certificate issuer for this server is not recognized by
Netscape. The security certificate may or may not be valid.
Netscape refuses to connect to this server.
Proxy server at flash.sugarland.unocal.com on port 8080