Hi All

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.