NWS Weather Forecast Messenger PHP Script by Mike Challis
Version: 1.00 - 10-Jul-2009 - release
Version: 1.01 - 10-Jul-2009 - fixed flood filter (do not use version 1.00)
Version: 1.02 - 10-Jul-2009 - added features: selectable temp units setting.
- if twitter message is too long, attempts to shorten it by abbreviating some weather condition words.
- prints on the web page how long the flood filter is still in effect for…
(Flood filter is in effect for 5 hours, 9 minutes, no twitter was sent)
Version: 1.04 - 22-Jul-2009 - added post authentication feature.
Version: 1.06 - 15-Aug-2009
- added email Bcc feature
- improved instructions inside readme.txt
Version: 1.07 - 16-Nov-2009 - add Return-Path header to email.
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.01 - 29-Sep-2011 - NWS changed the data URL, this update uses the correct URL.
Partially based on a variation of the following scripts:
NOAA Top Weather Advisory Alerter PHP Script by Mike Challis
http://www.642weather.com/weather/scripts-noaa-top-weather-alerter.php
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
Twitter Code by http://morethanseven.net/2007/01/20/posting-to-twitter-using-php/
Forecast code based on http://jivebay.com/2008/04/08/free-weather-forecast/
What does it do?
This PHP script is used to check the NOAA Weather XML Forecast feeds on a timed schedule,
then send a forecast message.
Uses the forecast for the the latitude longitude you have set in the settings.
The forecast message is short enough to send to twitter, a cell phone, blackberry, or email.
Supports sending messages by Email and Twitter, each method can be enabled or disabled.
Messages can be customized in the script settings.
Includes some of the features of the NOAA Top Weather Advisory Alerter PHP Script
http://www.642weather.com/weather/scripts-noaa-top-weather-alerter.php
What do I need?
PHP 5 with CURL support 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 6 hours.
… your PHP server MUST allow PHP scripts permission to write files.
… PHP safe_mode is recommended to be off
How to use it:
-
Set your settings in the “settings” of the PHP script.
Be sure to set the latitude, longitude, twitter user password and your email address.
Also set the settings for Email and Twitter to customize the messages, each method can be enabled or disabled. -
Upload this php file to your web server
-
Test from a URL, see if you can see the HTML output
Example: http://www.yoursite.com/nws-forecast-messenger.php
After testing move it to a private non-public web server folder.
Warning: it is recommended that you put the PHP file in a non-public www directory!
because you do not want people clicking the URL and flooding you with emails and twitters!!
If you put it in a non-public www directory, then the only way you can call it is from a cron job
There is a flood filter setting that will prevent the flood problem, but make you should test it,
don’t just “set it and forget it”. -
It is recommended that you test an email or twitter to make sure you will receive one.
-
Schedule automatic timed updates (see readme.txt)
Download
www.642weather.com/weather/scripts/nws-forecast-messenger.zip
Live Demo
www.642weather.com/weather/nws-forecast-messenger.php
My Twitter
http://twitter.com/642weather