#!/usr/bin/perl -w # # Grabs a weather forecast from BoM webpage and gives me the text # bit. # # Last updated by rb on Wed Nov 12 22:31:26 EST 2003 # use strict; use LWP::UserAgent; #use Data::Dumper; my $DEBUG = 1; my $VERSION = "0.1"; my $ua = new LWP::UserAgent; # This is the specific URL where the Melbourne Precis forecast is # stored. Dunno how to calculate others, just go to # www.bom.gov.au and check! my $req = new HTTP::Request GET => "http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV10420.txt"; my $response = $ua->request($req); if ($response->is_success) { # Yep, got the data my $data = $response->as_string; # grap response #$DEBUG && print Dumper($data); $data =~ m#
(.*)
#is; # just the bit in 'pre' tags print $1; } else { print $response->as_string, "\n"; } print "\n";