homepage Welcome to WebmasterWorld Guest from 54.226.10.234
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
LWP " can't connect error
gprather

5+ Year Member



 
Msg#: 3962120 posted 11:54 pm on Jul 29, 2009 (gmt 0)

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

#!/usr/bin/perl
#use strict;
#use LWP::Simple;
use LWP::UserAgent;
#use URI::URL;

print "Content-type: text/html\n\n";
print <<HTML;
<html>
<head>
<title>TEST</title>
</head>
<body>
HTML

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

my $ua = new LWP::UserAgent;
$ua->timeout(120);
my $request = new HTTP::Request('GET', 'http://www.yahoo.com');
my $response = $ua->request($request);
my $content = $response->content();
print "$content";
print <<HTML;
</body>
</html>
</head>
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.

-G

 

bsterz

10+ Year Member



 
Msg#: 3962120 posted 5:08 pm on Aug 1, 2009 (gmt 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?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved