in reply to LWP::Simple get function...

I don't have ActivePerl installed here at work, but other than the fact that 'LWP::Simple' should be 'use LWP::Simple;', this code works fine under Perl on Linux. I just ran it here, and got the homepage for www.perl.com, as one would expect. I copied your code verbatim.

You might try another page somewhere, maybe on a local server. Also check to see that you have the most recent version of libwww installed. Other than that, I don't see any reason it shouldn't be working.

--Chris

e-mail jcwren
  • Comment on (jcwren) RE: LWP::Simple get function...

Replies are listed 'Best First'.
RE: RE: LWP::Simple get function...
by Anonymous Monk on Jul 24, 2000 at 20:52 UTC
    I think I figured it out. Thanks for the quick response! Being behind a firewall with no internal DNS server, the script was unable to resolve any addresses and therefore just gave up. If I look up the IP address for any site and use it instead everything works great. Thanks for the hint I needed!
      hmmm...sounds like you have a firewall that does masquerading. If you have an actual http/ftp proxy, you might want to try this out.
      use LWP::UserAgent; use HTTP::Request::Common; if ($#ARGV != 0) { print STDERR "Usage: $0 \"URL to fetch\"\n"; exit; } my $agent = new LWP::UserAgent; $agent->proxy(['http','ftp'],'http://192.168.1.1:8080'); my $req = GET($ARGV[0]); my $res = $agent->request($req); if ($res->is_success) { print $res->content; } else { print $res->status_line,"\n"; }
      This is a little script I wrote that does a simple get. I'm behind a firewall as well. LWP::Simple might have a proxy option, but I had this code handy. This way you won't have to look up the IP of every host you want to connect to.

      /\/\averick

        If the following condition is met:
        if ($#ARGV != 0) {
        What does this mean?


        Update : I needed to specify the output directory. Not sure if it needs to be created first though as i now get the error message:
        400 URL must be absolute