-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrabVAHealth.pl
49 lines (35 loc) · 921 Bytes
/
grabVAHealth.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl
# Example code from Chapter 1 of /Perl and LWP/ by Sean M. Burke
# http://www.oreilly.com/catalog/perllwp/
#require 5;
use strict;
#use warnings;
use LWP::Simple;
my $i;
my $myURL;
my $filename;
for ($i = 1; $i <= 845; $i++) {
$filename = "VA/VAHealthSearch/results" . threeDigit($i) . ".htm";
open(FO, ">" . $filename) or die "Cannot open file $filename";
my $myUrl = "http://www.vahealthprovider.com/search_results.asp?whichpage=$i&last_Name=&county=All&specialty=Any&submit=Search";
my $content = get($myUrl);
print FO $content;
print "Wrote $myUrl to $filename\n";
close(FO);
sleep 30;
}
print "done! Ta Da \n";
sub threeDigit
{
my $num = $_[0];
if ($num < 10) {
return "00" . $num;
} elsif ($num < 100) {
return "0" . $num;
} else {
return $num;
}
}
__END__
n