Skip to main content.

NWS Weather Forecast Messenger PHP Script

Ever want to receive NWS weather forecasts by cell phone, blackberry, Twitter, or email? Now you can.

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.

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 use it?
1) Set your settings in the "settings" section in the 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.

2) Upload the php file to your web server

3) Test from a URL, see if you can see the HTML output.
Example: After testing, you can 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 and allow you to have it in a public folder, but make sure you should test it, don't just "set it and forget it".

see readme.txt for more info about settings

Please refer to the forum post on the Weather Watch Forum for the discussion.

NWS Weather Forecast Messenger PHP Script: [demo] | [download it] | [Discuss it]

More Weather PHP Scripts


If you find this site or the free PHP scripts useful to you, please consider making a small donation to help offset my time and the routine expenses of operation of this website. Thanks for your kind support! - Mike Challis

This php code provided "as is," and Long Beach Weather (Michael Challis) disclaims any and all warranties, whether express or implied, including (without limitation) any implied warranties of merchantability or fitness for a particular purpose. Use of this code signifies your acceptance.