R
RP
Hi, I'm trying to get the data off of a number of different pages, and
I'm getting an error:
500 Can't connect to www.yahoo.com:80 (connect: Permission denied)
My code is very simple, I'm just trying to get this to work:
#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
my $url = 'http://www.yahoo.com';
my $browser = LWP::UserAgent->new;
my $response = $browser->get($url,
'User-Agent' => 'compatible; MSIE 6.0; Windows 98',
'Accept' => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
image/png, */*',
'Accept-Charset' => 'iso-8859-1,*',
'Accept-Language' => 'en-US',
);
print "Content-type: text/html\n\n";
if ($response->is_success)
{ print $response->content; }
else { print $response->error_as_HTML; }
(Most of this code is copied from Spidering Hacks.) I've been
assuming that the problem is that the headers I'm sending, but I
really don't know - I'm a neophyte with LWP::UserAgent (and most perl
modules, for that matter). Could there be a problem with the response
my server is giving to the request? I've never had any luck getting
LWP::UserAgent/LWP::Simple/HTML::Tokeparser to work on that server,
even extremely simple programs. I've been struggling with this for
weeks, and I'm at a total loss. Help?!?! Thanks a million!
I'm getting an error:
500 Can't connect to www.yahoo.com:80 (connect: Permission denied)
My code is very simple, I'm just trying to get this to work:
#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
my $url = 'http://www.yahoo.com';
my $browser = LWP::UserAgent->new;
my $response = $browser->get($url,
'User-Agent' => 'compatible; MSIE 6.0; Windows 98',
'Accept' => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
image/png, */*',
'Accept-Charset' => 'iso-8859-1,*',
'Accept-Language' => 'en-US',
);
print "Content-type: text/html\n\n";
if ($response->is_success)
{ print $response->content; }
else { print $response->error_as_HTML; }
(Most of this code is copied from Spidering Hacks.) I've been
assuming that the problem is that the headers I'm sending, but I
really don't know - I'm a neophyte with LWP::UserAgent (and most perl
modules, for that matter). Could there be a problem with the response
my server is giving to the request? I've never had any luck getting
LWP::UserAgent/LWP::Simple/HTML::Tokeparser to work on that server,
even extremely simple programs. I've been struggling with this for
weeks, and I'm at a total loss. Help?!?! Thanks a million!