Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   How to download a .gif file using perl. (http://www.velocityreviews.com/forums/t899254-how-to-download-a-gif-file-using-perl.html)

Qing 07-31-2006 07:55 PM

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

use warnings;
use strict;
use POSIX 'strftime';
use LWP::Simple;

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


axel@white-eagle.invalid.uk 07-31-2006 08:23 PM

Re: How to download a .gif file using perl.
 
Qing <qingchengottawa@yahoo.com> wrote:
> I need to download lots of .gif files from a website by using perl. But
> the following code doesn't work. Can anybody help?


> use warnings;
> use strict;
> use POSIX 'strftime';
> use LWP::Simple;


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


'Doesn't work'? In what way does it not work?

Axel

Paul Lalli 07-31-2006 08:28 PM

Re: How to download a .gif file using perl.
 
Qing wrote:
> 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');



Qing 07-31-2006 08:35 PM

Re: How to download a .gif file using perl.
 
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 Lalli wrote:
> Qing wrote:
> > 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');



Paul Lalli 07-31-2006 08:51 PM

Re: How to download a .gif file using perl.
 

[Top-quoting fixed. Please don't do that. Type your reply *below* the
material you are quoting, after snipping signatures and other
irrelevant bits.]

Qing wrote:
> Paul Lalli wrote:
> > Qing wrote:
> > > 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


Mumia W. 07-31-2006 09:17 PM

Re: How to download a .gif file using perl.
 
On 07/31/2006 03:35 PM, Qing wrote:
> Paul Lalli wrote:
>> Qing wrote:
>>> 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.



All times are GMT. The time now is 05:00 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.