Frisbeeman has asked for the wisdom of the Perl Monks concerning the following question:
This works great for yahoo.com or other generic sites. It shows yahoo.com with "Here is the page's contents:" at the top. However, when I try it on my site, it fails to connect. My web host told me that they know of the problem, but they don't know why it doesn't work. They told me to see if I could find a work around. I tried it in PHP as well, same deal. Anyway, while I struggle with the web host to fix this issue, I'm trying to find another way to do it. What are other ways to connect to a url and retrieve the data? Thanks for the help.#!/usr/local/bin/perl # Tests for site crawler / db creator use LWP::Simple; use LWP::UserAgent; use HTTP::Request; use HTTP::Response; use HTML::LinkExtor; $browser = LWP::UserAgent->new(); $browser->timeout(10); $URL = 'http://www.yahoo.com/'; my $request = HTTP::Request->new(GET => $URL); my $response = $browser->request($request); if ($response->is_error()) {printf "%s\n", $response->status_line;} $contents = $response->content(); print "Content-type: text/html\n\n"; print "<html>\n<head><title>Site Crawler</title></head>\n<body>"; print "<b>Here is the page's contents:</b><br>$contents"; print "</body>\n"; print "</html>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Site Crawler
by Elian (Parson) on Jun 13, 2002 at 21:35 UTC | |
by Frisbeeman (Initiate) on Jun 13, 2002 at 22:27 UTC | |
by Elian (Parson) on Jun 13, 2002 at 23:00 UTC | |
|
•Re: Site Crawler
by merlyn (Sage) on Jun 13, 2002 at 21:06 UTC | |
by tjh (Curate) on Jun 13, 2002 at 22:30 UTC | |
by Frisbeeman (Initiate) on Jun 13, 2002 at 22:37 UTC | |
by merlyn (Sage) on Jun 13, 2002 at 22:46 UTC | |
|
Re: Site Crawler
by dws (Chancellor) on Jun 13, 2002 at 20:36 UTC | |
by Frisbeeman (Initiate) on Jun 13, 2002 at 20:47 UTC | |
|
Re: Site Crawler
by Frisbeeman (Initiate) on Jun 13, 2002 at 20:58 UTC | |
|
Re: Site Crawler
by Frisbeeman (Initiate) on Jun 13, 2002 at 23:11 UTC |