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)

New User

5+ Year Member

joined:July 29, 2009
votes: 0

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)

Preferred Member

10+ Year Member

joined:June 20, 2003
posts: 558
votes: 0

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?