I coded a PHP script that sends a text message to a list of people who are subscribed when severe weather warnings are issued. The script works good. However the problem right now is if I have it on a cron job every 5 minutes to check for a warning, every 5 minutes that a warning is in effect a text message will be sent to the subscribers. Is there a way to have a 5 minutes cron job but only send the text if the external file at the weather service is updated? That probably sounds really complicated but I will include my simple part of the text message script. Thanks for the help, Dave
[php] $url = ‘http://www.weatheroffice.gc.ca/rss/warning/on-151_e.xml’;
$search_torwarn = ‘SNOW SQUALL WARNING IN EFFECT’;
$subject = “SOWX ALERT”;
$message = "Snow Squall Warning For: Barrie - Collingwood - Hillsdale. Visit http://www.sowx.ca for more information. ";
$file_contents = file_get_contents($url);
if(strpos($file_contents, $search_torwarn) !== FALSE){
mail("@msg.telus.com,@msg.telus.com",$subject,$message,"From: SOWX ALERTS");
}[/php]