NWS Public Alert Messenger PHP Script
(old title) NOAA Top Weather Advisory Alerter PHP Script by Mike Challis
Version: 1.16 - 28-Oct-2009 - NWS recently added County codes in addition to Zone codes.
Changed code to allow Zone or County codes.
Version: 1.15 - 09-Sep-2009 - Added setting
// normally when the Advisory is canceled or expires, and the cache is updated,
// it sends out email/text alert stating “There are no active watches, warnings or advisories”.
// disable this?
$disable_expired_message = false; // change to true to disable alert ended alert
Version: 1.14 - 02-Sep-2009 - Fixed zone name twice in alert message, and more improved top alert selection.
Version: 1.13 - 01-Sep-2009 - Fixed error when Air Quality Alert, improved top alert selection.
If it cannot figure out which alert is the top most alert, it will select the 1st one.
Version: 1.12 - 31-Aug-2009 - If you have one of the rss-asvisory.php or rss-top-warning.php script that is pre version 2.00
the cache file could conflict with the other script.
If this condition is detected, the script will output: “Advisory Information Unavailable, cache file conflict, view source for details.”
If you view the source you will see more details about the cause and how you can fix it (upgrade your other scripts to 2.00 or higher, or rename the $cacheName setting to something other than rss-advisory.txt).
Version: 2.00 - 13-Jun-2010 - added OAuth/Twitter authentication (TweetWX642) because user/password authentication is being disallowed after June 30th, 2010 (Thanks to Joe Chung and Ken True for providing the auth code)
Version: 2.10 - 15-Mar-2010 - Updated weather.gov feed URL
(new title)NWS Public Alert Messenger PHP Script by Mike Challis
(old title)NOAA Top Weather Advisory Alerter PHP Script by Mike Challis
Partially based on a variation of the following scripts:
RSS Top Warning PHP Script by Ken True http://saratoga-weather.org/scripts.php
PHP NOAA Advisory Text by Tom Chaplin http://www.carterlake.org/weatherphp.php
warnscroll.php by Jim McMurry - http://jcweather.us
Twitter Code from http://morethanseven.net/2007/01/20/posting-to-twitter-using-php/
What does it do?
Ever want to receive severe weather alerts by cell phone, blackberry, Twitter, or email? now you can.
This PHP script checks the NOAA RSS Weather Alert feeds on a timed schedule, then messages you if an alert status changes in the zone you have set.
The alert message is short enough to send to a cell phone, blackberry, or email.
Twitter is also optionally supported. Supports sending messages by email and Twitter.
Includes most of the features of the NOAA RSS Top Warning 2009 PHP Script
http://discourse.weather-watch.com/t/40859
What do I need?
PHP 5 is required
… Web server hosting account with PHP support and ability to send emails from PHP
… Ability to schedule a cron job or a scheduler program on your PC that can request a URL every 15 minutes.
… your PHP server must allow PHP scripts permission to write files. safe_mode is recommended to be off
How to use it:
-
Set your settings in the “settings” section in the script
Be sure to set the NOAA zone and your email address.
Set all the settings for Email and Twitter, each method can be enabled or disabled. -
Upload the php file to your web server
-
Test from a URL, see if you can see the output
Example: http://www.yoursite.com/rss-weather-alerter.php
see readme.txt for more info
Download:
www.642weather.com/weather/scripts/noaa-top-weather-alerter.zip
Live Demo :
www.642weather.com/weather/rss-weather-alerter.php