简体   繁体   中英

Perl LWP does not work

I'm using Padre as my IDE with Strawberry Perl on Windows 7 Pro.

I'm trying to create a perl script that goes to a text file on a website, and then reads/copies the text file.

But I can't get LWP to work even for the simplest LWP command ever.

#!/usr/bin/perl
   use strict;
   use warnings;
   use LWP::Simple;

   getprint('http://www.perlmeme.org') or die 'Unable to get page';

   exit 0;

I keep getting this error message: 500 can't connect to proxy.sn.no:8001 (Bad hostname) eg 500 can't connect to (Bad hostname) http://www.perlmeme.org

I've been googling around, used Microsoft Fixit to reset ports, etc but I still can't make it work. http//www.justskins.com/forums/lwp-connect-failing-bad-119421.html

Can anyone help me out here? Been stuck for many hours :(

Edit:

--1 foreach my $key (keys %ENV) { print "$key: $ENV{$key}\\n" if $key =~ m/proxy/i; }

Yes it prints out FTP_PROXY and HTTP_PROXY both followed by this: http://proxy.sn.no:8001/

That's the proxy that I got from this helpthread How do I install a module? Strawberry Perl issues

I had the proxy problem, then I tried the config from that thread, then the proxy problem was still there.

--2 I'm not expecting any proxy to be used on my end or anything. Just wanna connect the perl script to the website to retrieve a text document.

--3 ping had 0% loss. (I can only post two hyperlinks in this post)

--4 I'm using Windows.

LWP will honor the http_proxy environment variable and try to use it as an HTTP proxy. Check with env | grep http_proxy env | grep http_proxy on Unix.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM