kevyt has asked for the wisdom of the Perl Monks concerning the following question:
use warnings; use strict; # use Image::Grab; use LWP::Simple; open (IN, '< McKesson_Items_test.csv') or die ("Can't open the input f +ile $!"); while (<IN>){ chomp; my($item_number, $sku, $desc) = split /\,/; #print $item_number, $sku; my $url = 'https://mms.image.mckesson.com/CumulusWeb/Images/High_R +es/' . $sku . '.jpg'; #my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 } +); #my $req = HTTP::Request->new("GET", $url); #my $rep = $ua->request($req); #print $rep->status_line; use LWP 5.64; my $browser = LWP::UserAgent->new; my $response = $browser->get($url); die "Error at $url\n ", $response->status_line, "\n Aborting" unless $response->is_success; print "Whee, it worked! I got that ", $response->content_type, " document!\n"; #my $path = 'Images\\' . $item_number . '.jpg'; #my $path = $item_number . '.jpg'; #print " $url, $path\n"; #getstore($url, $path) or die "Can't download: $@\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How can I get images from urls - Getting 443 and 500 errors
by hippo (Archbishop) on Mar 20, 2015 at 17:43 UTC | |
by kevyt (Scribe) on Mar 20, 2015 at 18:37 UTC | |
by kevyt (Scribe) on Mar 20, 2015 at 17:54 UTC | |
|
Re: How can I get images from urls - Getting 443 and 500 errors
by kevyt (Scribe) on Mar 20, 2015 at 17:35 UTC |