That solved the problem that I was having in Mechanize and "Not implemented".my $a = WWW::Mechanize->new(autocheck => 1, agent => 'Mozilla/4.0 (compatible; MSI +E 6.0; Windows NT 5.0; T312461)', keep_alive=> 1); my @silly_headers = ('Accept-Language' => 'en-us', 'Accept-Encoding' => 'gzip, deflate', 'Accept' => '*/*'); $a->get($testpage, @silly_headers);
Now, for the new puzzler, which is not a Perl problem, per se, but which I hope has a Perl solution: There is a secure web site that I can access via browser, but when I try to get to the login page via WWW::Mechanize, I get a failure. Unlike my previous problem, this website is public. However, the problem is most likely tied to the proxy server, so there's still going to be some difference when you run it vs. when I do.
While the error message appears to come from the proxy, I note that I do not have a problem in accessing the site, via the same proxy, from a browser. Very odd.
Here's the script:
#!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; MSI +E 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_st +ring()."\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 <HTML> <HEAD><TITLE>Error</TITLE></HEAD> <BODY> <H1>Error</H1> <BLOCKQUOTE><B> <HR SIZE=4><P> The requested item could not be loaded by the proxy.<P> 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.<P> <HR SIZE=4> </B></BLOCKQUOTE> <P> <ADDRESS>Proxy server at flash.sugarland.unocal.com on port 8080</ADDR +ESS> </BODY></HTML>
In reply to More Mechanize Woes by Roy Johnson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |