[pm-h] LWP::UserAgent
Mike Flannigan
mikeflan at att.net
Sun Feb 19 12:51:57 PST 2012
I've got a question for you guys. Maybe an
easy question.
I want to download the file '02251_new_1923-0059.zip'
from the website:
https://spatialdata.iu.edu/DOQQS/state/sanborn/public/tif/1923/
The script below works (I think), but it outputs the
file to STDout. I haven't tried yet, but I gather if
I print this to a filehandle I will not get the binary
zip file, but a text file instead.
What is the proper way to download the file to a binary
zip file using LWP::UserAgent and the Crypt-SSLeay module
I just obtained from University of Winnipeg?
http://johnbokma.com/perl/https.html
Mike
use warnings;
use strict;
use LWP::UserAgent;
my $url =
'https://spatialdata.iu.edu/DOQQS/state/sanborn/public/tif/1923/02251_new_1923-0059.zip';
my $ua = LWP::UserAgent->new;
my $response = $ua->get( $url );
$response->is_success or die "Failed to GET '$url': ",
$response->status_line;
print $response->as_string;
__END__
More information about the Houston
mailing list