Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^3: save image on web

by saskaqueer (Friar)
on Dec 21, 2004 at 05:51 UTC ( #416388=note: print w/replies, xml ) Need Help??

in reply to Re^2: save image on web
in thread save image on web

In addition to NetWallah's suggestions, the site may also be blocking according to the referrer URL, or by the user-agent of the "browser", or possibly even by a cookie (if the image URL is that of a CGI script). Try this code (which is completely untested):

#!perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common; my $url = ''; my ($referer) = $url =~ m!^(https?://[^/]+/)!; my $ua = LWP::UserAgent->new( agent => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0)', cookie_jar => {} ); # probably not needed, only needed if cookie is used # to test for "real browser". highly unlikely, but you # never know! $ua->get($referer); my $req = HTTP::Request->new( GET => $url ); $req->referer($referer); print $ua->request($req)->content();

Replies are listed 'Best First'.
Re^4: save image on web
by kcella (Beadle) on Dec 21, 2004 at 12:32 UTC
    Got the following message when trying to run saskaqueer's code:

    LWP will support https URLs if the Crypt::SSLeay module is installed. More information at <>.

    I tried installing Crypt::SSLeay, but ppm3 does not have a win32 version.

    As for NetWallah's suggestions, I have a direct URL to the image, so it is not in a frame. It is also under 4 MB, not generated by javascript and not beign re-directed. I can download it manually just fine. I would post the URL, but it would not help since it is part of a password protected site and it would just redirect you to a login.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://416388]
[Happy-the-monk]: Goody-goody!
[Discipulus]: still happy Happy-the-monk? even in 2018? good for you.. ;=)
[choroba]: Good morning!

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2018-01-23 08:42 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (242 votes). Check out past polls.