Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

LWP " can't connect error



11:54 pm on Jul 29, 2009 (gmt 0)

5+ Year Member

Hi everyone, the following code works from my linux shell as root or the 'nobody' accounts:

#use strict;
#use LWP::Simple;
use LWP::UserAgent;
#use URI::URL;

print "Content-type: text/html\n\n";
print <<HTML;

my $url_variable = $input{'URL'};

my $ua = new LWP::UserAgent;
my $request = new HTTP::Request('GET', 'http://www.yahoo.com');
my $response = $ua->request($request);
my $content = $response->content();
print "$content";
print <<HTML;

BUT when I hit that same .pl file with my browser I get the following error:

500 Can't connect to www.yahoo.com:80 (Bad hostname 'www.yahoo.com')

Can someone help me please? I'm doing something idiotic, I know, and anything you could do to help would be appreciated.



5:08 pm on Aug 1, 2009 (gmt 0)

10+ Year Member

Is your apache process running as either root or nobody? I know it's a basic question, but can you confirm under what account apache is running?

Featured Threads

Hot Threads This Week

Hot Threads This Month