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$
In reply to LWP::UserAgent and sending the HTTP_REFERER by mellin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |