They're free, but use at your own risk
The scripts referenced here are used in the operation of this weather station, and may be freely copied and used to support your station. Please note that you use these scripts at your own risk. No warranty is expressed or implied. I accept no liability for any damages that may ensue from their use.
You will need to configure them for your own particular weather station website.
A RSS Feed is available to help keep you informed on updates to the scripts.
A Version History is available -- check back from time to time to see if there are updates to scripts you have downloaded earlier.
Announcements of version updates and new scripts are made on
and saratogaWXPHP Twitter account as they become available.
This page was updated
Tuesday, 22-Jan-2013 10:19 PM
PHP for current NEXRAD Radar station status display
This script will read (and cache for 60 seconds) the NWS WSR-88D Transmit/Receive Status page, extract the current status for a selected NEXRAD Station name, and format and display any Free Text messages associated with that station. The default for the script is to not display anything if the selected station is currently 'Green'(Active), and return a message if the station data is 'old' or has 'no data'. I'm using this on my radar page above the GRLevel3 heading to report status on Station KMUX.
// change myRadar to your local NEXRAD radar site ID.
// other settings are optional
$myRadar = 'KMUX'; // San Francisco
$noMsgIfActive = true; // set to true to suppress message when radar is active
$ourTZ = 'PST8PDT'; // timezone
$timeFormat = 'D, d-M-Y g:ia T';
// boxStyle is used for <div> surrounding the output of the script .. change styling to suit.
$boxStyle = 'style="border: dashed 1px black; background-color:#FFFFCC; margin: 5px; padding: 0 5px;"';
$cacheFileDir = './'; // default cache file directory
$cacheName = "radar-status.txt"; // used to store the file so we don't have to
// fetch it each time
$refetchSeconds = 60; // refetch every nnnn seconds
// end of settings
- This is the 4-character NEXRAD Radar station name.
If used in the AJAX/PHP template, the setting will be replaced by the contents of $SITE['GR3radar'].
- If set = false, then status and messages will be displayed in a box of style $boxStyle.
If set = true, then status of active will not display, and only 'problem' messages will be displayed in a box of $boxStyle.
If used in the AJAX/PHP template, the setting will be replaced by the contents of $SITE['showradarstatus']
- Set to your current timezone (PST8PDT, MST7MDT, CST6CDT, EST5EDT or appropriate TZ for your locale)
If used in the AJAX/PHP template, the setting will be replaced by the contents of $SITE['tz']
- This is the template used to format the dates displayed.
Default is 'D, d-M-Y g:ia T' which produces dates like 'Mon, 21-Jan-2008 12:29pm PST'
If used in the AJAX/PHP template, the setting will be replaced by the contents of $SITE['timeFormat']
- This is the style specification for the box surrounding the output of the script. It will not be used if the $noMsgIfActive = true; and the selected NEXRAD station is 'active'.
'style="border: dashed 1px black; background-color:#FFFFCC; margin: 5px; padding: 0 5px;"'
- This is the relative file path to the directory used to store the $cacheName file.
The default is './' for the current directory. If used in the AJAX/PHP template, this setting will be replaced by the contents of $SITE['cacheFileDir']
- This is the name of the cache file used to store the HTML page from the NWS Radar Status website. Make sure this file is writable by the PHP script.
- This specifies the lifetime for the cached page. After this number of seconds, a new page will be fetched and cached.
Include the following code in the page where you'd like the output to appear:
<?php include("radar-status.php"); ?>
Samples of the output (
With $noMsgIfActive = false: )
Download radar-status.php script (V1.08 - 22-Jan-2013) [see version history]
- Version 1.08 - 22-Jan-2013 - fixed deprecated split() function call
- Version 1.07 - 31-Aug-2012 - removed excess \n characters in messages and handling for chunked response
- Version 1.06 - 26-Jan-2011 - added support for $cacheFileDir global cache directory
- Version 1.05 - 03-Jul-2009 - added support for PHP5 timezone setting
- Version 1.04 - 04-Feb-2009 - fixed to handle change to NWS website
- Version 1.03 - 07-Apr-2008 - fixed $SITE['showradarstatus'] actions for true=show, false=suppress
- Version 1.02 - 25-Feb-2008 - integrate with carterlake/WD/PHP template settings control
- Version 1.01 - 30-Jan-2008 - handle improperly terminated message
- Version 1.00 - 21-Jan-2008 - Inital release