Weather station scripts

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.
RSS feed for Scripts Updates A RSS Feed is available to help keep you informed on updates to the scripts.

Many of these scripts are now available on GitHub at

If you find one or more of the scripts useful to you, please consider making a donation to help offset the routine expenses of operation of this website.
Thanks for your kind support!

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 Weather-Watch forums and saratogaWXPHP Twitter account as they become available.

This page was updated Friday, 22-May-2020 12:04 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.


// settings:  
//  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   = 'America/Los_Angeles'; // 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'.
Default is '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: )

Active display
No Recent data
No Data


Download radar-status.php script (V1.17- 22-May-2020) [see version history]

Version History

  • Version 1.17 - 22-May-2020 - update to support wxnwsradar*.php scripts in Base-USA template
  • Version 1.16 - 04-Feb-2018 - use https to site
  • Version 1.15 - 22-Feb-2017 - use cURL for URL fetch+improved debugging info
  • Version 1.14 - 24-Sep-2016 - fixes for NWS page design changes
  • Version 1.13 - 03-Aug-2016 - fixes for NWS URL/page design changes
  • Version 1.12 - 06-Jul-2015 - changes for updated radar status report page
  • Version 1.11 - 04-Jun-2015 - changes for new radar status report page and separate ftm.txt detailed status messages fetch
  • Version 1.10 - 04-Jun-2015 - changed to new URL for radar status report
  • Version 1.09 - 09-May-2014 - fixes for NWS website changes
  • 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