Advisory Information Unavailable, error fetching or reading data from the NOAA advisories server.
I keep getting this error, any thoughts or pointers?
http://w3mpf.net/?page_id=36[insert_php]
$includeOnly = true;
$DefaultZone = 'PAC103';
$doSummary = true;
$hurlURL = "advdetail.php";
include_once("atom-advisory.php");
[/insert_php]
^^This is the code I have on the page that I would like to display the feed on
<?php
/*
NOAA ATOM/CAP Advisory PHP Script
rss-advisory.php version 1.00 - 17-Apr-2006 (Ken True)
atom-advisory.php version 2.00 - 31-May-2009 (Mike Challis)
http://saratoga-weather.org/scripts.phpYou are free to use and modify the code
This php code provided "as is", and Ken True, Mike Challis
disclaims any and all warranties, whether express or implied, including
(without limitation) any implied warranties of merchantability or
fitness for a particular purpose.
Version 1.01 - 16-Aug-2006 - added cacheing for RSS feed
Version 1.02 - 08-Dec-2007 - added time formatting for lastBuildDate
Version 1.03 - 17-Dec-2007 - added safety features from Mike Challis -
http://www.642weather.com/weather/scripts.php fixed XHTML 1.0-Strict output, improved debug code,
added file-mode include functions
Version 1.04 - 22-Jan-2008 - added graceful failure code from Mike Challis
Version 1.05 - 27-Jan-2008 - added many features from Mike Challis, rename to rss-advisory.php
accommodates a different CSS style for when there is no advisory,
backwards compatible with old include methods if you are not going to use the
CSS style switch for no advisory / advisory
NOTE: to use the new feature (CSS style switch for no advisory / advisory)
use the new php include params and add the sample css (see settings notes),
added invalid zone error code
added option to lowercase the advisories text
Version 1.06 - 02-Feb-2008 - added wxflyer.php support from Mike Challis.
see:
http://www.weather-watch.com/smf/index.php/topic,28523.0.html when used for a printable flyer, advisory titles are shown without URL links
Live example:
http://www.642weather.com/weather/local-flier.php (the live example only shows advisories when they are currently active)
Version 1.07 - 04-Feb-2008 - added support for Carterlake/AJAX/PHP template set
Version 1.08 - 17-Mar-2008 - added improved cache file error handling
Version 2.00 - 31-May-2009 - beta version specific to new beta NWS feeds
http://www.weather.gov/alerts-beta/ modded by Mike Challis -
http://www.642weather.com/weather/scripts.php (not backwards compatible with old feeds, requires PHP5)
see:
http://www.weather-watch.com/smf/index.php/topic,40119.0.htmlVersion 2.00 - 31-Aug-2009 No longer BETA
Version 2.01 - 21-Sep-2009 Renamed at atom-advisory.php to avoid confusion and allow coexistance with
rss-advisory.php which used the RSS feeds instead of the ATOM/CAP feeds.
Version 2.02 - 22-Sep-2009 Changed to use HTTP/1.1 requests
Version 2.03 - 29-Oct-2009 Added County zone code capability (M Challis)
Version 2.04 - 28-Jan-2010 Fixed unterminated entity reference error (M Challis)
Version 2.05 - 05-Jul-2010 Added new $doZoneTitles setting (M Challis)
Version 2.06 - 26-Jan-2011 Added support for $cacheFileDir global cache directory
Version 2.07 - 05-Mar-2011 Updated support for $cacheFileDir with template override
Version 2.08 - 15-Mar-2011 Changed URL for NWS ATOM/CAP feeds
Version 2.09 - 05-Nov-2011 fixes for "* Storm Warning" icon selection
*/
$Version = 'atom-advisory.php - V2.09 05-Nov-2011';
/*
This script gets the current ATOM/CAP Zone Watch/Warning/Advisory/Statement
from
www.weather.gov/alerts-beta/ for the selected Zone and provides either
a summary (titles only, with links) or details. It returns
'There are no active watches, warnings or advisories for zone CAZ513'
if there are no cited hazards in the Zone CAZ513.
output: creates XHTML 1.0-Strict HTML page (default)
Options on URL:
inc=Y -- returns only the body code for inclusion in other webpages. Omit to return full HTML.
summary=Y -- returns only the titles of the cited hazards N.N or greater.
zone=ssZnnn -- select the Zone to use.
Pick the Zone from the RSS feed list at
http://www.weather.gov/alerts/ and use the RSS County/Zone for your area.
detailpage=xxx -- set your page of full advisories ie: detailpage=advisories.php
cache=refresh -- reload the cache
Example URL:
http://your.website/atom-advisory.php?zone=CAZ513 would return data for hazards in Zone=CAZ513 which is Santa Clara County, California
#########
# PHP Include Usage:
#########
You can include this with summary output only
or you can include it with full advisory text output:
There are two ways of including the script in your pages depending on whether your hoster has
allow_url_include option set to on or off. The URL method only works if allow_url_fopen
is on in your PHP settings. The File method usually always works.
#########
# Include and display alert links only, not full alert details:
# Live example:
http://www.642weather.com/weather/index.php#########
to include this with Summary output only, put the following code in your php page inside php tags:
if ( isset($_GET['zone']) ) {
$DefaultZone = $_GET['zone'];
} else {
$DefaultZone = 'PAC103'; // set to your NOAA zone
}
$detailpage = 'advisories.php'; // overrides $hurlURL setting
$doSummary = 1; // display alert links only, not full alert details
$includeOnly = 1; // include mode
$noprint = 1; // required for echo $advisory_html output
include 'atom-advisory.php';
if (preg_match("|There are no active|i",$advisory_html) ||
preg_match("|Advisory Information Unavailable|i",$advisory_html)) {
echo '<div class="advisoryBoxnoactive">' .$advisory_html .'</div>';
}else{
echo '<div class="advisoryBox">' . $advisory_html .'</div>';
}
#########
# Include and display full alert details::
# Live example:
http://www.642weather.com/weather/advisories.php#########
to include this with Full advisory output, put the following code in your php page inside php tags:
if ( isset($_GET['zone']) ) {
$DefaultZone = $_GET['zone'];
} else {
$DefaultZone = 'PAC103'; // set to your NOAA zone
}
$detailpage = 'advisories.php'; // overrides $hurlURL setting
$includeOnly = 1; // include mode
$noprint = 1; // required for echo $advisory_html output
include 'atom-advisory.php';
if (preg_match("|There are no active|i",$advisory_html) ||
preg_match("|Advisory Information Unavailable|i",$advisory_html)) {
echo '<div class="advisoryBoxnoactive">' .$advisory_html .'</div>';
}else{
echo $advisory_html;
}
#########
# CSS sample:
#########
put this css style code in your css file (modify the colors if you like)
(no need to worry about this if you use the PHP carterlake templates)
see live sample at
http://www.642weather.com/weather/index.phpforum discussion page:
http://www.weather-watch.com/smf/index.php/topic,29274.0.html.advisoryBox {
color: black;
font-size: 12px;
text-align: center;
background-color: #FFE991;
margin: 0 0 0 0;
padding: .5em 0em .5em 0em;
border: 1px dashed rgb(34,70,79);
}
.advisoryBoxnoactive {
color: black;
font-size: 12px;
text-align: center;
background-color: white;
margin: 0 0 0 0;
padding: .5em 0em .5em 0em;
border: 1px dashed rgb(34,70,79);
}
//------------------------------------------------------------------
// begin settings
//------------------------------------------------------------------
*/
// change $myDefaultZone default(below) to your stations county zone
// other settings are outlined below, and are optional
$myDefaultZone = 'PAC103'; // <== change this to your zone
$hurlURL = 'wxadvisory.php'; // <== change this default to your webpage to open for details
$HD = 'h2'; // <== type of heading for advisories <$HD>...</$HD>
$doLowerCase = true; // <== change to true to lowercase the advisories (new in ver. 1.05)
$doLongTitles = true; // <== change to true to add the zone name to the Alert Title (new in ver. 2.00)
// Heat Advisory
// Heat Advisory - South Washington Coast (Washington)
$doZoneTitles = true; // <== change to true to add the full zone name to the No Active Alert Title
// false = There are no active watches, warnings or advisories for zone WAZ021.
// true = There are no active watches, warnings or advisories for South Washington Coast (Washington).
// cacheDir cacheName is name of file used to store cached current conditions
$cacheFileDir = './httpdocs'; // default cache file directory
$cacheName = 'atom-advisory.txt'; // used to store the file so we don't have to fetch it each time
// note: the real cache name will automatically be the above name with the Zone included
// ie: rss-advisory.txt => rss-advisory-CAZ513.txt
$fullMessagesMode = true; // note: enabling this uses more resources,
// but is desired to fetch the complete message for each alert. (new in ver. 2.00)
// Set the timezone for your location, because some servers are in different timezone than your location
//
http://saratoga-weather.org/timezone.txt has the list of timezone names
// uncomment one ourTZ setting: NOTE: this *MUST* be set correctly or alert times will be incorrect
$ourTZ = 'America/New_York'; // Eastern Time
//$ourTZ = 'America/Chicago'; // Central Time
//$ourTZ = 'America/Denver'; // Mountain Time
//$ourTZ = 'America/Phoenix'; // Mountain Standard Time - Arizona
//$ourTZ = 'America/Los_Angeles'; // Pacific Time
// time format for alert's updated, effective and expired timestamps
$timeFormat = 'D d-M-y h:ia T'; // Tue 02-Jun-09 06:14pm TZone
// cache interval time
$refetchSeconds = 600; // refetch every nnn seconds (600=10 minutes)
// Alert icons (new in version V2.00 20-Jul-2009 BETA .025)
// Each alert will display along with an icon image to indicate the type and severity of the alert.
// To use this feature, you must download the icons from here:
//
www.642weather.com/weather/scripts/noaa-advisory-images.zip$enable_alert_icons = false; // this feature is optional
// Alert icons directory. Only needed if Alert icons are enabled.
// This setting is so you can name the images folder to what ever you like.
$icons_folder = './alert-images'; // No slash on end
// $flyer (this setting moved to wxflyer.php)
// as of version 2.00, this setting moved to wxflyer.php
// $flyerpromo (this setting moved to wxflyer.php)
// as of version 2.00, this setting moved to wxflyer.php
//------------------------------------------------------------------
// end settings. Do not alter any code below this point in the script or it may not run properly.
//------------------------------------------------------------------
^^This is the code I put on a php page in my /httpdocs
http://w3mpf.net/atom-advisory.php^^If I go to this directly I see the "No Active Watches..." so I know I did something right