NWS Public Alert Messenger PHP Script

It works like the NOAA RSS Top Warning 2009 PHP Script
http://discourse.weather-watch.com/t/40859

If there are multiple alerts, it will send you the one it thinks is most urgent.
Once it has an active alert it saves it in a cache file. Your script should run every 10 minutes on a schedule.
Every time the script runs it checks the cache file for the current alert status.
If the alert status changes again, to another warning or to no warning, then it will send another alert message indicating what it changed to.

You can have it email you.
You can have it auto post to Twitter.
You can email and twitter at the same time.

I have mine email my cell phone a text message.

I do not use Twitter yet. Can someone try it and tell me if the Twitter feature works?
Thanks, it works :smiley:

http://www.twitter.com/cnyweather

The tiny URL went to your scripts. correct mike?

EDIT: my bad. didn’t realize I could fix it. All set now.

Can you add multiple email addresses you think??

// be sure to set zone= to your actual zone
$Zone = 'NYZ037';

// email address to receive the messages
$email_address = '[email protected]';

THANKS MIKE!! 8)

Yes you can send to multiple emails, both methods are acceptable

// email address to receive the messages
// Yes you can send to multiple emails, both methods are acceptable
// $email_address = '[email protected], [email protected]';
$email_address = '[email protected]';

I did find one small bug. (the twitter message did not have the zone title)

You could download the fix…
Version: 1.01 - 08-Jul-2009 - fix for adding zone name to the Alert message

Version: 1.02 - 08-Jul-2009 - added global user agent string for outbound connections

Trying to add facebook, but the curl api I am using does not work :x
They no longer allow the CURL method.
I think I have found a way to update facebook status from the twitter tweet.
http://apps.facebook.com/selectivetwitter/
I need to investigate this more.

Did I mention… I do not use facebook or twitter yet? :lol:

Version: 1.03 - 09-Jul-2009 - added feature to customize the email subject and message

  • improved web page details that are displayed.

Cool

Thank you
Mark

tested it out today both of them, Will be getting those online tonight sometime!

Version: 1.04 - 10-Jul-2009 - more improvements to web page details that are displayed.

Thanks for all the hard work mike!

Version: 1.05 - 10-Jul-2009 - fixed bug where the email message had the zone title added twice.

Dumb question Mike. Possible to only alert to certain things?

I seem to get a ton of Short Term Forecast and would like warnings/watches
to show only if possible

OK, try this new version and let me know if it works.

Version: 1.06 - 10-Jul-2009 - added feature, new setting:
// some areas get too many Short Term Forecast and would like warnings/watches alerts only
$ignore_forecasts = false; // change to true to ignore “Short Term Forecast” alerts

Beer’s on me Mike. Installing it now. Thank You!

Great App… Works like a charm Thanks Mike =D>

Have mine all installed both of them. But had to put into a seperate directory and let the owner be the only one able to read write and execute the files. So now if i type in the directory name those files are in comes up 403 error also had to place a seperate copy of the rss-top-warning-2009 in there also. as it would not allow writing to the directory when pulling from another. So now waiting for the 15 mins to run and see if the cron runs it, have to wait 6 hours for the other.

My scripts run in the same directory on my server, no problem.
Some servers are setup to be very strict about file permissions.

Some users have file permissions problems with the cache files:
Here are some tips:
(Do this only if you are having file permissions errors!)
Create the file in Notepad or similar text editor. The file can be empty.
adv-alert-email-XXXXX.txt (substitute XXXXX for your NOAA zone code in UPPER CASE)
rss-advisory-XXXXX.txt
Upload it to your server and CHMOD it to 666
You may continue to have problems if your server has “safe_mode on” or other restrictions on file create, file write functions.
In that case, find out if you can use your own php.ini to change PHP settings.
Please consult your web host tech support, or perhaps get another less restrictive web host!

nws-forecast-messenger & rss-weather-alerter work perfect with the way i had to set them, Just tested them now to make sure they where sending the data from the cron job. And sure enough the forecast was there and the weather alerter i had to set to test as there are none here now, and get my email on the phone for both.

Great job you guys do!

Dont see Special Weather Statements coming through to Advisory Alerter Mike.

I do see that in the beta feeds

http://www.weather.gov/alerts-beta/wwaatmget.php?x=NYZ037

Tony, I just loaded up the script with your zone and it worked.

If email is not sending, here is couple things to troubleshoot:
Correctly set the $email_address and $email_address_sent_from
By default, email is disabled. ( I guess I did this because you have to set your email address anyway and while there you should look at all the settings)
To enable email sending, set the change the setting $do_not_email = 1; to $do_not_email = 0;
The script will only send out an alert email one time when there is a change in alert status.

Hey everybody! What about this idea?
Currently, the script will only sends out an alert email one time when there is a change in alert status.
I might add a feature to resend the alerts every xx amount of hours.
This could be an option setting to turn on or off and set a time interval.

Sometimes in the winter I get a high wind warning that lasts for 3 days.
Using this proposed feature it could resend the alerts every 12 hours.

I use this feature ($flood_filter_enabled and $flood_filter_minutes) in my NWS Weather Forecast Messenger PHP Script
My cron actually calls that script every 15 minutes, but I set the $flood_filter_minutes to 355 minutes.
This allows the script to send a message approx every 6 hours. I think this feature would be great for this script also, I would set it to every 12 hours. also it would not send messages when there are no alerts.

Edit: Feature added in Version: 1.07 - 11-Jul-2009