Quote: There are three sorts of people. Optimists who think the glass is half full, Pessimists who think the glass is half empty, and sailors who don't care so long as the other half isn't in their lap. - Tom
Oceanhippie.net - Tom's Blog
Here you will find stuff on Tom's travels, with empasis on video, pictures and PC Desktop wallpapers.
I'm a sailor and WiFi specialist, so you'll find technical stuff here too.
Display Inshore forecast from BOM for digital signage or website
the Following code will go grab the xml for the Darwin Harbour inshore forecast from BOM and save it to disk as a htm and txt file.
The idea is run it once as a cron job - then just call the txt or htm file to display it for hte rest of the day
getElementsByTagName('forecast') as $e ) {
$e = $e->parentNode; // this should be the element
foreach( $e->getElementsByTagName('forecast-period') as $l ) {
if($l->getAttribute('index')=='0') {
$date = date( "l jS F ", strtotime($l->getAttribute('start-time-local')));
$curTxt= "Forcast for Darwin Harbour for $date \n \n";
$curHtm= "
\n";
}
}
}
}
//Dispaly as text
echo $curTxt;
file_put_contents('../../imagecache/forecast.txt', $curTxt); //save file for rest of the day.
//separator
echo "############################################################################## \n";
//display as html
$curHtm=$curHtm."
";
echo $curHtm;
file_put_contents('../../imagecache/forecast.htm', $curHtm); //save file for the resrt of hte day.
?>