I tried to grab a page using this code on my Mint10 PC. For some reason it chokes. I tried the same on another Mint17 PC connected through the same network and it worked. But I don't understand what the error is trying to tell me. Any suggestions? I was able to get python to get the same page on the Mint10 PC too using python's urilib.
Here's the code
use LWP::UserAgent; use HTTP::Request::Common qw(GET); use HTTP::Cookies; my $ua = LWP::UserAgent->new; # Define user agent type $ua->agent('Mozilla/8.0'); # Cookies $ua->cookie_jar( HTTP::Cookies->new( file => 'mycookies.txt', autosave => 1 ) ); # Request object my $req = GET 'http://www.perlmeme.org'; # Make the request my $res = $ua->request($req) || die "Bad Get"; # Check the response if ($res->is_success) { print $res->content; } else { print ">> ",$res->status_line . "\n"; }
here's the response
try_web_get.pl >> 500 Unexpected keys - LocalHost
Thanks to anyone who may help
In reply to LWP::UserAgent error Unexpected keys - LocalHost by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |