Alternative ATOM Feed Alert Program

An “all-in-one” program is available to display top warnings and full details from the ATOM feed provided by the National Weather Service.

It is designed to handle several NOAA zones at a time and can be used with or without the Carter Lake template set.
Two sets of usable web pages are included along with a demo page, detailed instruction and a set of 72 icons.
Main features include top warnings, top warning icons, alert box and an XML page. Each alert type is color coded to its severity and has a small icon so it can be easily distinguished when there are several alerts for each zone. All alerts from NOAA’s NWS ATOM/XML are accepted when available.

The script uses code borrowed (with permission) from Mike Challis to fetch the data and Michael (mth) of Relay Weather contributed some code, features and did extensive beta testing.
Because of the amount of zones that the script can handle, a cron job must be used to call the script. If your web host doesn’t offer the ability to do crons, information in the read me file will guide you on how this can be done in a proven and reliable method. A “pseudo-cron” does not work and is not supported. PHP 5 is required.

I have the demo page here AtomDemo
Relay weather has this running on his web site Relay Weather

Download everything here AtomAlerts.zip

  • EDITED - This download reflects a new version that replaces this original version.

Curly

Looks nice. :smiley:
I can tell you spent a lot of time programming that.

<?php
include("AtomArray.php");
$error = '';
if (isset($_REQUEST['zone']) && preg_match("/^[A-Z]{2}Z[0-9]{3}$/i", $_REQUEST['zone'])) {
$A_Zone = $_REQUEST['zone']; // valid zone syntax from input
$zone_error = true;
}
else {
$zone_error = false;
$error = 'Invalid zone or no zone entered in URL';
}
?>

I would use GET instead of REQUEST when you are importing variables from a URL.

All,

I wanted to display a few things that can be done with this script. I’ve set up some temporary zones that currently have some advisories.

Check out the top warning box here (the icons give it a nice touch):
http://www.relayweather.com/

Check out the summary page which allows you to view all zones you have entered in the script:
http://www.relayweather.com/AtomSummary.php

Check out the detail of each zone:
http://www.relayweather.com/AtomZone.php?zone=AZZ002&loc=Lake Havasu, Fort Mohave Arizona#WL

This is very easy to get going, supports the new NWS ATOM format and looks very nice. Thanks to Curly for a great job!! :slight_smile: :slight_smile:

Michael

Thanks Mike & Michael!

Made the change to $_GET in the AtomZone.php file.
Also changed the AtomFeed.php file putenv for the time zone to date_default_timezone_set.

I see another issue.

on this page, you have URL links with spaces. They should be urlencoded so the spaces are changed to %20, or a plus (+)
http://www.weather.ricksturf.com/AtomDemo.php

http://us3.php.net/urlencode

Im getting an error:
Warning: include(AtomArray.php) [function.include]: failed to open stream: No such file or directory
I didn’t see the (AtomArray.php) included in the zip file

Same Here…No File.

Yeah here neither…

Try running the AtomFeed.php file manually, you will then see three (3) files get created. AtomWork.php, AtomCache.php and AtomArray.php.

These three files are the files that are created and updated when you run the script AtomFeed.php

didnt work here…

http://www.snoqualmieweather.com/AtomFeed.php

Hang tight…I’m sure Curly will have this resolved very shortly. :slight_smile:

Mark, your server does not have permission to create files.
I logged in and CHMOD your “web” folder to 777, ran AtomFeed.php and it created the files, then I CHMOD the “web” folder back to 715.

Working fine here Thanks :lol:

#-o LOL…Thanks again Mike. I see its working.

OK Back again…

Fixed the blank spaces in the URL.
Instead of downloading the zip file, copy the code here http://www.weather.ricksturf.com/scripts/AtomFeed.php?sce=view

As a side note, if you have a problem with the script or web page, please post a link.

Thanks
Curly

Mike went in and changed my permissions and that fixed it. Thanks.

Great!

Glad it’s working…

Great script! Thanks. I’m a little confused after reading the docs as what I have to do to get the the warning box part to work so that it has the icon next to it. I know I need to include AtomsFeed.php but I’m not sure of where I need to place some other code (tags). Can someone provide me the exact code I need and where it needs to be placed and in what file.

Thanks,

John

In your index.php, place this at the top just under your

<?php print $alert_box; ?>

Be sure you have called the AtomArray.php file too

Michael

Okay got the short term forecast to show. The warning box is not showing around. How do I get this to show and text centered?

Thanks,

John