How to download a .gif file using perl.

P

Paul Lalli

Qing said:
I need to download lots of .gif files from a website by using perl. But
the following code doesn't work. Can anybody help?

There's a fairly obvious set of debugging steps one should take in this
situation. Can you please tell us what steps you've taken to debug
your problem, so that no one here is duplicating your effort?

Paul Lalli

[Code retained below for informational purposes]
 
Q

Qing

The file got downloaded, but not the right size, so the .gif file
couldn't be opened.
The correct file size should be 34kb, the downloaded (using perl)file
size is only 13kb.


Paul said:
Qing said:
I need to download lots of .gif files from a website by using perl. But
the following code doesn't work. Can anybody help?

There's a fairly obvious set of debugging steps one should take in this
situation. Can you please tell us what steps you've taken to debug
your problem, so that no one here is duplicating your effort?

Paul Lalli

[Code retained below for informational purposes]
use warnings;
use strict;
use POSIX 'strftime';
use LWP::Simple;

getstore('http://websiteMainpageURL/picshow.asp?dir=Vocab7-9&page=pg1S.gif',
'pg1S.gif');
 
P

Paul Lalli

[Top-quoting fixed. Please don't do that. Type your reply *below* the
material you are quoting, after snipping signatures and other
irrelevant bits.]
Paul said:
Qing said:
I need to download lots of .gif files from a website by using perl. But
the following code doesn't work. Can anybody help?

There's a fairly obvious set of debugging steps one should take in this
situation. Can you please tell us what steps you've taken to debug
your problem, so that no one here is duplicating your effort?

Paul Lalli

[Code retained below for informational purposes]
use warnings;
use strict;
use POSIX 'strftime';
use LWP::Simple;

getstore('http://websiteMainpageURL/picshow.asp?dir=Vocab7-9&page=pg1S.gif',
'pg1S.gif');
The file got downloaded, but not the right size, so the .gif file
couldn't be opened.
The correct file size should be 34kb, the downloaded (using perl)file
size is only 13kb.

So, the answer to my actual question - What steps have you taken to
debug your problem? - seems to be: "I tried the code, and saw that the
sizes are different. Then I posted to Usenet." Is that accurate?

Please TRY to debug your own problem!
* Capture the return value of the call to getstore()
* Check if it was a successful call
* Try going to the URL manually, and seeing if the file downloads
successfully in your own browser
* If the URL is to a server you have access to, check that server's
logs

Once you make an attempt at solving your own problem, and demonstrate
that you are putting effort into it, you will likely receive better
help from forums such as this one.

Also, please read (and follow) the Posting Guidelines for this group.
They are posted here twice a week.

Paul Lalli
 
M

Mumia W.

Paul said:
Qing said:
I need to download lots of .gif files from a website by
using perl. But the following code doesn't work. Can
anybody help?
There's a fairly obvious set of debugging steps one
should take in this situation. Can you please tell us
what steps you've taken to debug your problem, so that no
one here is duplicating your effort?

Paul Lalli

[Code retained below for informational purposes]
use warnings; use strict; use POSIX 'strftime'; use
LWP::Simple;

getstore('http://websiteMainpageURL/picshow.asp?dir=Vocab7-9&page=pg1S.gif',
'pg1S.gif');

The file got downloaded, but not the right size, so the
.gif file couldn't be opened. The correct file size should
be 34kb, the downloaded (using perl)file size is only 13kb.

[ top posting fixed ]

Look in the file, and you might discover that's it's an HTML
error message saying you don't have permission to access that
file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top