|
-
March 16th, 2011, 01:55 PM
#1
Trouble using perl to download web files
Hello folks,
It’s been almost a decade since I’ve done any programming and I’m pretty rusty. I hope someone here can point me in the right direction (including if this is an appropriate forum to ask my question). I’m trying to use Perl’s getstore to download a series of web pages in PDF format. I’ve looked around for scripts and the best I found is what I adapted below:
PHP Code:
#!/usr/bin/perl use warnings; use strict; use LWP::Simple; my $count = 1;
my $urlfile = 'http://www.msa.md.gov/megafile/msa/speccol/sc2900/sc2908/000001/000075/pdf/am75--';
while ($count <= 730) { my $file = $count.'.html'; $count++;
my $url = "$urlfile$file";
getstore( "$url", "c:\\test\\$file\n" ); #print “$url\n”; }
It seems pretty straight forward, but it isn’t working and I can’t figure out why. When I run the script in just hangs in the terminal window until I CTRL-C out of it. If I comment out the getstore line and uncomment the print line I can tell the proper web filename is being formed.
I’ve tried throwing in a few traps to capture the status, but it seems like when getstore is executed that everything freezes. Any much wiser heads out there have an idea of what I’m doing wrong and how I can correct it?
Thank you kindly,
Scott
Last edited by PeejAvery; March 16th, 2011 at 02:19 PM.
Reason: Added code/php tags
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|