#!/usr/bin/perl -w $infilename = "WebPage.txt"; $sounddir = "/var/lib/asterisk/sounds/tts/"; $surfText = $sounddir."CurrentSurfReport.txt"; $surfWave = $sounddir."CurrentSurfReport.wav"; $t2wp= "/usr/bin/"; $debug = 1; sub main() { #d/l site if ($debug > 0) { system("wget -U 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915' --save-cookies=cookies.txt --output-document=WebPage.txt 'http://www.prh.noaa.gov/hnl/pages/SRF.php'"); } search1(); } sub search1() { $file = ""; open(OUTPUT, ">", $surfText); open(INPUT, $infilename); while ( ) { # $_ = /.*/; $file = $file.$_; } #print $file; # get name of island, date # This notation gets the whole file =~ $file =~ /SUMMARY\.\.\.(.*?)<\/p>/s; $tmp1 = $1; $TheOutput = $1; #Search and replace NW with surrounding whitespace chars, with northwest. $TheOutput =~ s/\sNW\s/northwest/i; $TheOutput =~ s/\sSW\s/southwest/i; $TheOutput =~ s/\sNE\s/northeast/i; $TheOutput =~ s/\sSE\s/southeast/i; $TheOutput =~ s/\sN\s/north/i; $TheOutput =~ s/\sS\s/south/i; $TheOutput =~ s/\sE\s/east/i; $TheOutput =~ s/\sW\s/west/i; print OUTPUT "$TheOutput"; close(OUTPUT); my $execf=$t2wp."text2wave -F 8000 -o $surfWave ".$surfText; system($execf); } main();