Alternative ATOM Feed Alert Program

They’re still down.

You don’t suppose the servers went down due to an overload? :-k

This is a great script! Thank you very much!
Just one question… How do I get the warnings and watches back on the top of my main page? Thank you for any help!
Joe
http://www.joe4speed.com/wxindex.php

Did you get any of that nasty weather this morning?

To add the alert box to a page, decide where you want it and paste this into the html:

<?php
echo "\n<!-- AtomFeed Alert Box-->";
include("AtomArray.php");
print $alert_box;
echo "\n<!-- end AtomFeed Alert Box-->\n";
?>

I’m still waiting for it to arrive, Curly!!! It’s taking its sweet time!

Thank you very much for the help and a great code! :slight_smile:

Having trouble with the cron job using Windows Task Scheduler. I have followed the setup but when it runs it never completes. When I refresh it still shows a status of running. It works fine when I run it in the browser. Anyone have any ideas or an alternate cron program that I can use?

Rick

Wait one minute…where is Curly…shows he’s now a “guest”?

I noticed that, too. Not only that his weather script download page is gone, too.

Thats not good. i sent him an email.

I found him on wxforums but he’s not answering my message…

I don’t know if this has been covered before, but for those that don’t use Linux or, want or have access to Task Scheduler (e.g., my host does not allow me access), or you don’t want to change your index file to a php file, then this is a good alternative. Since it is an asynchronous request, it allows the page to load as it is getting the data.

First you need jQuery: http://docs.jquery.com/Downloading_jQuery#Download_jQuery
For the script below, it is installed in a “js” subdirectory under the folder where the page is executed.

Create a webpage (straight .html is fine) and add the code below. For existing pages, add the javascript code and a div with the id of “v_Alerts” where you want the alert box to show up.

Also, on the line “url: ‘AtomAlerts/AtomFeed.php?rand=’ + (new Date()).valueOf()” change the location to that of your “AtomFeed.php” file (leave the ?rand… part).

Create a php file named “AtomAlertAjax.php” with the contents shown below (or whatever you want in your alert box).

Then run the html page… the page should load and when the javascript calls are complete, the alert box should show up.

The line “setTimeout(“SetAlerts()”, 60 * 1000);” controls how often the script checks for new info. In this case it is every 60 seconds.

If you do not want to use the body onload event, then you can use the jquery function:
$(document).ready(function () {
SetAlerts();
});

Example: http://www.bocafallsweather.com/testalerts.html

Webpage (e.g., index.html):


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<script type="text/javascript" src="js/jquery-1.5.1.js"></script> <!-- change folder to where this is located -->
<script type="text/javascript">
function SetAlerts() {
   $.ajax({
      url: 'AtomAlerts/AtomFeed.php?rand=' + (new Date()).valueOf(), //change to the location of your AtomFeed.php
      dataType: 'text',
      success: function (data, textStatus) {
      	try {
         //alert('Status is '+textStatus);
         //alert('JSON data string is: '+data);
         GetAlerts();
         } catch (err) {
            //Handle errors here
         }
         setTimeout("SetAlerts()", 60 * 1000);
      },
      error: function (xhr, ajaxOptions, thrownError) {
         alert('ErrorStatus: ' + xhr.status);
         alert('ErrorThrown: ' + thrownError);
      }
   });
}
function GetAlerts() {
   $.ajax({
      url: 'AtomAlertAjax.php?rand=' + (new Date()).valueOf(),
      dataType: 'text',
      success: function (data, textStatus) {
      	try{
         //alert('Status is '+textStatus);
         //alert('JSON data string is: '+data);
         
          $('#v_Alerts').html(data)
		  
         } catch (err) {
            //Handle errors here
         }
      },
      error: function (xhr, ajaxOptions, thrownError) {
         alert('ErrorStatus: ' + xhr.status);
         alert('ErrorThrown: ' + thrownError);
      }
   });
}
// Uncomment the following three lines if you don't want to use the body unload function
//$(document).ready(function () { 
//	SetAlerts();
//}); 

</script>
</head>
<body onload="SetAlerts()"> <!-- you can use the jQuery ready function instead of the onload function -->
<h2>ALERTS</h2>

<div id="v_Alerts"></div>



<div>Some more page data</div>

</body>
</html>

AtomAlertAjax.php:


<?php
echo "\n<!-- AtomFeed Alert Box-->";
include("AtomArray.php");
print $alert_box;
echo "\n<!-- end AtomFeed Alert Box-->\n";
?>


TestAjaxAlerts.zip (1.12 KB)

hello…

can someone help me out with 2 things concerning this script.?

  1. in the Atom-feed-Config.php file…what do I place in this section for my area?

COUNTY/ZONE SET UP

$Code_Location = array(
“INZ005” => “Elkhart Co”, // ELKHART IN - priority zone listed first
“INC039” => array(1 => “INC039”,‘a’ => “INZ005”), // COUNTY CODE => COUNTY CODE => ZONE CODE
“MDC005” => array(1 => “MDC005”,‘a’ => “MDZ011”,‘b’ => “MDZ006”), // COUNTY CODE => COUNTY CODE => ZONE CODE => ZONE CODE
“MDZ006” => “No.Balt.Co.”, // N Baltimore
“MDZ011” => “So.Balt.Co.” // S Baltimore
);

My Noaa Zone is MAZ021 and the County Zone is MAC023 for Plymouth County, but what else should I also add in? Should I add in the Noaa Zones for Western and eastern plymouth County? Stumped as to what I should be adding for this section and could use some insight from someone that knows what to do with this?

  1. on the top of my homepage in the warning box it currently reads “No Warnings, Watches or Advisories”…in what file can I edit this, so that when there are no watches.,warnings or advisories…it reads “There are currently no Watches,Warnings or Advisories in the Area”?

Thanks for any help, and by the way this script seems a bit better than the basic Atom script.

I have also yet to configure a Cron job or windows task scheduler part of the instructions, since I am on E-rice, I will most likely have to use the windows task scheduler option, but will do that afterwards.

…Chris

Chris,it may be a while til I get home from work, but I’ll send you the vbscript for task manager,in fact, if i remember correctly, Curly, when he was with us on the forum, had a copy of the VB script included in the instructions…

chris

Hi Chris,

I have been trying to work with this program also and ran into several issues.

I don’t understand all the necessary configurations that need to be done. I have in the location area for the Atom-feed-Config.php file as follows, don’t know if this is correct or not:

$Code_Location = array(
“HIZ020” => “Windward Haleakala”, // Maui HI - priority zone listed first
“HIC009” => array(1 => “HIC009”,‘a’ => “HIZ019”), // COUNTY CODE => COUNTY CODE => ZONE CODE
“HIC009” => array(1 => “HIC000”,‘a’ => “HIZ020”,‘b’ => “HIZ019”), // COUNTY CODE => COUNTY CODE => ZONE CODE => ZONE CODE
“HIZ020” => “Windward Haleakala”, // Windward Haleakala
“HIZ019” => “Central Maui Valley” // Central Maui Valley
);

As far as the cron job, I have no idea what this is, but attached is the one that I found some place for XP OS’s.

Guess that we are in the same boat at this time. Otherwise, hope all is well with you.

–Stan Y.
Maui, Hawaii


TaskSchedulerSetupXP.zip (2.21 KB)

This is what mine has. Its been working great for a long time now. You dont have to use all of the areas, just delete the lines if you dont want to use them all. I added some surrounding areas to show more results.


// county/zone codes => location
$Code_Location = array(
    "WAZ505" => "Snoqualmie,Wa", // Snoqualmie Wa - priority zone listed first
    "WAC033" => "King County",  // King County
    "WAZ508" => "Seattle Metropolitan Area, WA", // Seattle
    "WAZ509" => "Tacoma Area, WA", // Tacoma
    "WAZ519" => "West Slopes Central Cascades and Passes, WA", //
    "WAC061" => "Snohomish County, WA", // Snohomish County, WA
    "WAC037" => "Kittitas County, WA", // Kittitas County, WA
    "WAC053" => "Pierce County, WA" // Pierce County, WA

);


Hi Mark,

I will try to get mine to read like yours and see what happens for my area. Looks like I will need just 3 or 4 zones for the Island of Maui.

Thanks for the insight. Next to tackle that cron job issue if I need to… Will try with out it first and maybe Chris will be able to help me out a bit when his time permits.

–Stan Y.
Maui, Hawaii

I think I found a fix for this script. I am hoping some others will try it.

Change these two lines:

$AlertURL = 'http://www.weather.gov/alerts-beta/wwaatmget.php?x=';  // NWS URL for primary data

$AlertURL2 = 'http://www.weather.gov/alerts-beta/wwacapget.php?x='; // NWS URL for alert data

to:

$AlertURL = 'http://alerts.weather.gov/cap/wwaatmget.php?x=';  // NWS URL for primary data

$AlertURL2 = 'http://alerts.weather.gov/cap/wwacapget.php?x='; // NWS URL for alert data

Mike announced that here http://discourse.weather-watch.com/t/50400

So yeah, if some people didnt see that, then theres would stop working.

Rats. I missed that completely. Me, bringing up the rear again. :slight_smile:

Hi,

I think I found all of those fixes also. A lot of places needed to be changed…

–Stan Y.
Maui, Hawaii

Yeah Stan. There’s more places that need changed other than what was just posted.