mellin has asked for the wisdom of the Perl Monks concerning the following question:
I created a small script to download all the images from any given HTML page. It works otherwise just fine, but some sites are using redirection to their index page unless the user arrives onto this page from their site (server reading the HTTP_REFERER).
I took this into consideration in my script after reading a bit more about this from Google. Below is a snippet of the script that fails and the error, too
$http = LWP::UserAgent -> new; $http->timeout(10); $http->agent("Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"); $http->header('Referer' => "$referer") if defined $referer; # send HTT +P_REFERER if requested $content = $http->get($src);
www:~/Documents/testStuff/getImagesFromWww mellimik$ perl getImagesFro +mWww.pl http://localhost/ total of 1 images Can't locate object method "header" via package "LWP::UserAgent" at ge +tImagesFromWww.pl line 86. www:~/Documents/testStuff/getImagesFromWww mellimik$
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP::UserAgent and sending the HTTP_REFERER
by rpanman (Scribe) on Jul 21, 2007 at 14:42 UTC | |
|
Re: LWP::UserAgent and sending the HTTP_REFERER
by dsheroh (Monsignor) on Jul 21, 2007 at 15:00 UTC |