However, for some reason I keep getting this error once I get to the the date 18961110 (November 10 of 1896).
Error GETing http://bub2.meteo.psu.edu/wxstn/wxstn.htm: Can't connect to bub2.me teo.psu.edu:80 (connect: timeout) at C:\Perl\scripts\i.pl line 19The data for this date is available and I can access it manually by logging on to the site, so it's not that the server doesn't recognize the date.
What could be causing my program to fail at the same date each time? Also, it took about 3 minutes to get through October of the first year, yet I have over 100 years to go through. Is there any way for me to improve this code so that it was run faster?
Thanks a lot for any suggestions or advice!
use strict; use warnings; open(my $in, '<', "c:/perl/scripts/dates/dates.txt") or die "open: $!\n"; my @date; while (<$in>) { chomp; push(@date, $_); } close($in); use WWW::Mechanize; foreach my $date (@date) { my $mech = WWW::Mechanize->new(); $mech->get( "http://bub2.meteo.psu.edu/wxstn/wxstn.htm" ); $mech->form_number(1); $mech->field( 'dtg' , $date ); $mech->click(); $mech->content(); my $file = "c:/perl/scripts/dates/$date.txt"; $mech->save_content($file); $mech->back(); }
In reply to Connection Timeout duing form submissions by cheech
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |