Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Script to retrieve zip from internet

by djaesone (Initiate)
on Mar 20, 2006 at 00:27 UTC ( #537840=perlquestion: print w/replies, xml ) Need Help??

djaesone has asked for the wisdom of the Perl Monks concerning the following question:

I am new to Perl, and using Windows. I have a script I typed from a book. The script is to perform a series of downloads of zip files from a website. When I try running it, I seem to be getting "404 Not Found" errors. Any idea why?

The website is injected in the code as:

$baseurl = "";

I'm not sure if the problem is with the way the website is structured, or the code, or if my command line is failing to reach the internet for some reason.

Any thoughts are appreciated. Thanks!

Replies are listed 'Best First'.
Re: Script to retrieve zip from internet
by rafl (Friar) on Mar 20, 2006 at 00:38 UTC

    How about pasting some code? Would be very helpful for finding the problem.

    Nevertheless my script to do that would look like that:

    use strict; use warnings; use LWP::Simple; my $baseurl = ""; for (my $i = 0; $i < 100; $i++) { mirror("${baseurl}zipfile${i}.zip", "zipfile${i}.zip"); }

    The code assumes that the zipfiles are at the servers root directory and called zipfile${number}.zip where the $number is between 0 and 99. You will need to adapt it to your specifications. Also you should add some error handling.

    Cheers, Flo

Re: Script to retrieve zip from internet
by planetscape (Chancellor) on Mar 20, 2006 at 04:01 UTC

    Assuming you are using a module such as WWW::Mechanize (and I really can't help you much without knowing what you are using - that's where a snippet of your code would be really helpful):

    I would suggest using a module such as HTTP::Recorder or WWW::Mechanize::Shell to record a successful download of a zipfile. The output of HTTP::Recorder, for instance, can be "dropped" right into your WWW::Mechanize scripts.

    Another important tool for finding out what is really happening behind the scenes between server and browser is a protocol analyzer such as Ethereal.

    Don't forget that Super Search is your friend here on PM...


Re: Script to retrieve zip from internet
by ayrnieu (Beadle) on Mar 20, 2006 at 00:34 UTC

    Yes, the problem could lie in any of those that you suggest. I wish you luck in your continued investigations.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://537840]
Approved by spiritway
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-05-25 22:38 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (90 votes). Check out past polls.