#!/usr/bin/perl require "../cgi-lib.pl"; ReadParse(*in); *params = *in; use LWP; if($ENV{HTTP_USER_AGENT}) { $web = 1;} else { $web = 0; } print "Content-type: text/html\n\n" if($web); print "
\n"; %rtdesc = ( '3Na' => "Rte. 3 North (Rte. 128/I-95 to I-495)", '3Nb' => "Rte. 3 North (I-495 to NH Line)", '3Sa' => "Rte. 3 South (I-495 to Rte. 128/I-95)", '3Sb' => "Rte. 3 South (NH Line to I-495)", '495Na' => "I-495 North (Mass Pike/I-90 to Rte. 3)", '495Nb' => "I-495 North (Rte. 3 to I-93)", '495Nc' => "I-495 North (I-93 to I-95)", '495Sa' => "I-495 South (Rte. 3 to Mass Pike/I-90)", '495Sb' => "I-495 South (I-93 to Rte. 3)", '495Sc' => "I-495 South (I-95 to I-93)", '93Na' => "I-93 North (Central Artery to Rte. 128/I-95)", '93Nb' => "I-93 North (Rte. 128/I-95 to I-495)", '93Nc' => "I-93 North (I-495 to NH Line)", '93Sa' => "I-93 South (Rte. 128/I-95 to Central Artery)", '93Sb' => "I-93 South (I-495 to Rte. 128/I-95)", '93Sc' => "I-93 South (NH Line to I-495)", '128Na' => "Rte. 128/I-95 North (Mass Pike/I-90 to Rte. 3)", '128Nb' => "Rte. 128/I-95 North (Rte. 3 to I-93)", '128Nc' => "Rte. 128/I-95 North (I-93 to I-95)", '128Nd' => "Rte. 128 North (I-95 to Gloucester)", '128Sa' => "Rte. 128/I-95 South (Rte. 3 to Mass Pike/I-90)", '128Sb' => "Rte. 128/I-95 South (I-93 to Rte. 3)", '128Sc' => "Rte. 128/I-95 South (I-95 to I-93)", '128Sd' => "Rte. 128 South (Gloucester to I- 95)", #extra space! '95Na' => "I-95 North (Rte. 128 to NH Line)", '95Sa' => "I-95 South (NH Line to Rte. 128)", '90Ea' => "Mass Pike/I-90 East (I-290/I-395 to I-495)", '90Eb' => "Mass Pike/I-90 East (I-495 to the Weston Tolls)", '90Ec' => "Mass Pike/I-90 East (Weston Tolls to Allston/Brighton Tolls)", '90Ed' => "Mass Pike/I-90 East (Allston/Brighton Tolls to SE Expressway)", '90Wa' => "Mass Pike/I-90 West (I-495 to I-290/I-395)", '90Wb' => "Mass Pike/I-90 West (Weston Tolls to I-495)", '90Wc' => "Mass Pike/I-90 West (Allston/Brighton Tolls to the Weston Tolls)", '90Wd' => "Mass Pike/I-90 West (Southeast Expressway/I-93 to Allston/Brighton Tolls)", '9300Nd' => "Southeast Expressway/Rte. 3/I-93 North", '9300Sd' => "Southeast Expressway/Rte. 3/I-93 South", '300Nc' => "Rte. 3 North (Sagamore Bridge to Braintree)", '300Sc' => "Rte. 3 South (Braintree to Sagamore Bridge)", '49500Nd' => "I-495 North (I-95 to Mass Pike/I-90)", '49500Ne' => "I-495 North (Bourne Bridge to I-95)", '49500Sd' => "I-495 South (Mass Pike/I-90 to I-95)", '49500Se' => "I-495 South (I-95 to Bourne Bridge)", '9500Nb' => "I-95 North (I-495 to Rte. 128/I-93)", '9500Nc' => "I-95 North (Rhode Island to I-495)", '9500Sb' => "I-95 South (Rte. 128/I-93 to I-495)", '9500Sc' => "I-95 South (I-495 to Rhode Island)", '12800Ne' => "Rte. 128/I-95 North (I-95 to Mass Pike/I-90)", '12800Nf' => "Rte. 128 North (Southeast Expressway and I-95)", '12800Se' => "Rte. 128/I-95 South (Mass Pike/I-90 to I-95)", '12800Sf' => "Rte. 128 South (I-95 to Southeast Expressway)", ); %rtpage = ( '3' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=5&city=bos&cityname=Boston', '495' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=9&city=bos&cityname=Boston', '93' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=7&city=bos&cityname=Boston', '128' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=6&city=bos&cityname=Boston', '90' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=10&city=bos&cityname=Boston', '95' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=8&city=bos&cityname=Boston', '300' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=26&city=bos&cityname=Boston', '49500' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=27&city=bos&cityname=Boston', '9300' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=11&city=bos&cityname=Boston', '12800' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=29&city=bos&cityname=Boston', '9500' => 'http://www.smartraveler.com/scripts/bostraffic.asp?index=28&city=bos&cityname=Boston', ); $ua = new LWP::UserAgent; $ua->agent("Foo/0.1 ".$ua->agent); $ua->timeout(60); my(%pagedata) = (); #print "About to load pages\n"; foreach $route (keys %rtdesc) { my($baseroute) = $route; $baseroute =~ s/[A-Za-z]+//g; $url = $rtpage{$baseroute}; #print "I want to load $url\n"; if(!defined($pagedata{$url}) || !$pagedata{$url}->is_success) { #print "Loading $baseroute ..."; my($request) = new HTTP::Request GET => $url; $request->content_type('application/x-www-form-urlencoded'); $request->content('match=www&errors=0'); $pagedata{$url} = $ua->request($request); #print "Done!$lnum"; } else { print ">"; } $lnum++; } else { print ">"; limg($key{$td},$x,$y); } print " | \n"; $wide++; } print "