drblove27 has asked for the wisdom of the Perl Monks concerning the following question:

Dear Wise Monks, I have been struggling how to do something that I think should be simple, but is eluding me. I have a list of images that I am trying to download and save to my own hard drive. For example,
use strict; use LWP::Simple; my $url ='https://app.e2ma.net/userdata/22031/images/e1214960519.jpg'; my $filename = 'e1214960519.jpg'; getstore($url,$filename);
And when I go to the directory that I am running the script from, nothing is there. Plus I searched the entire hard drive for the file to see if I just stored it in the wrong place, could not find it. I am thinking it is because of the https, but not really sure how to get around this. I am running ActiveState 5.10 in Vista (I know, I know...). Any thoughts? Thanks in advance!

Replies are listed 'Best First'.
Re: Saving a image from web
by GrandFather (Saint) on Oct 09, 2008 at 01:31 UTC

    Have you checked the value returned by getstore? The LWP::Simple documentation says that it returns the "HTTP response code" which may give you a clue about the failure mode.


    Perl reduces RSI - it saves typing
      Sorry for not checking this earlier. I get a 501 error when I run the code. I am not sure how to get around this error. Any help would be appreciated, I searched through the site before leaving my question. Thanks in advance for your help, I really appreciate it.
Re: Saving a image from web
by drblove27 (Sexton) on Oct 09, 2008 at 02:12 UTC
    Ok, I think I found 2 different solutions: First for this particular example I can switch out the https:// for http:// and then everything works. Also I installed Crypt::SSLeary and that also does the trick. Thanks for reading, hopefully this solution will help other people.