M
maw246
I'm fairly new to Perl, so I hope this doesn't seem like a stupid
question.
I'm trying to download an image using a Perl script, because I want to
be able to automate the image download process. My code looks like
this:
#-----------------------
use Win32::Internet;
$inet = new Win32::Internet();
$myfile =
$inet->FetchURL("http://image.weather.com/web/common/wxicons/31/30.gif");
open (OUTP, ">30.gif");
print OUTP $myfile;
#-----------------------
It seems very simple, right? And when I use this to download a text
file or html file, it works just fine. However, when I use this same
code to download other file types-- such as the GIF file in this code
example, ZIP files, or PDFs-- the associated viewing applications see
the files as corrupt and won't open them. Yet when I download the GIF
via internet explorer and file compare it against what I downloaded in
perl, no differences are found . . . but there's a slight difference in
file size.
Can anyone tell me what I'm doing wrong? If so, please offer a
specific solution, because as I wrote above, I'm a bit of a newbie.
--Thanks
question.
I'm trying to download an image using a Perl script, because I want to
be able to automate the image download process. My code looks like
this:
#-----------------------
use Win32::Internet;
$inet = new Win32::Internet();
$myfile =
$inet->FetchURL("http://image.weather.com/web/common/wxicons/31/30.gif");
open (OUTP, ">30.gif");
print OUTP $myfile;
#-----------------------
It seems very simple, right? And when I use this to download a text
file or html file, it works just fine. However, when I use this same
code to download other file types-- such as the GIF file in this code
example, ZIP files, or PDFs-- the associated viewing applications see
the files as corrupt and won't open them. Yet when I download the GIF
via internet explorer and file compare it against what I downloaded in
perl, no differences are found . . . but there's a slight difference in
file size.
Can anyone tell me what I'm doing wrong? If so, please offer a
specific solution, because as I wrote above, I'm a bit of a newbie.
--Thanks