My first post. I have been "lurking" here for ages and now own a Fine Offset WS.
It seems that the MetOffice is soon going to ease the current restrictions on the use of much of the data on their website. A document at http://www.opsi.gov.uk/unlocking-servic ... mmentstart explains, wherein there is specific reference to their radar imagery soon being possibly classified as either unregistered or registered free content.
In eager anticipation I have been coddling together a PHP script to download, say, the Rainfall Radar image. But I have a coding problem I cannot solve: sometimes the images are not available for a short while, during updates etc., and an http request returns empty but I haven't been able to work out how to expand the script to load an alternate "image not available" image in that situation. Can anybody give me a few pointers?
Code: Select all
//Set latest MetOffice radar/satellite image(s) URL
date_default_timezone_set('Atlantic/Azores'); //image timestamp lags 1hr
$YmdH = date("YmdH");
$Ymd = date("Ymd");
$hcorrection = time() - 3600;
$hcorrected = date("H",$hcorrection);
$datei = "00" ;
if (date("i") <= 15) {
$fetchtime = $Ymd.$hcorrected.$datei;
}
else {
$fetchtime = $YmdH.$datei;
}
/*
usage example:
echo "<img src ='http://www.metoffice.gov.uk/weather/images/uk_radar_".$fetchtime.".gif' width=212 height=314>";
*/
//end set URL
Derek
http://sheerwater.info (under construction!!)