3 Hour Refresh Code Problem
Posted: Sat Aug 27, 2011 7:38 am
Hello,
I am trying to load an external image from a NOAA site directory. This image refreshes every three hours, starting with 0 and then 3,6,9,12.....21 in a 24 hour calendar, and are stored for days in advance. The date/time is in the file name. Originally I had written the script to refresh on the hour, and then realized the tri-hourly spacing. This is what I have:
I am not fluent in php, but I assume I need a "If H=1,4,7,10,13,16,19,22; Then H+2 ; along with If H=2,5,8,11,14,17,20,23; Then H+1" to keep the images relatively current. I just can't quite wrap my head around how to express this.
Any help is appreciated.
Thank you.
I am trying to load an external image from a NOAA site directory. This image refreshes every three hours, starting with 0 and then 3,6,9,12.....21 in a 24 hour calendar, and are stored for days in advance. The date/time is in the file name. Originally I had written the script to refresh on the hour, and then realized the tri-hourly spacing. This is what I have:
Code: Select all
<?php
date_default_timezone_set('Etc/GMT-1');
$today = date("YmdH");
$pattern = '/WaveHeight_'.$today.'_mic.png';
$base_url = 'http://www.crh.noaa.gov/images/greatlakes/ndfd/MIC/dynamic2';
print '<a href="http://www.crh.noaa.gov/greatlakes/?c=map&l=lm&p=a"><img src="'.$base_url.$pattern.'" width= "237" hieght= "314" " ></a>';
?>
Any help is appreciated.
Thank you.