He said:
"I’d suggest that a detection for PHP5 be inserted in the script, since you’re using simple_xml function and that could save a few trouble calls
An option to ‘fetch-through’ to the real alert text would be nice so folks don’t get short-changed by the
text display (fetch the link and save the for display if the non-summary mode is active)."
I added detection for installations less than PHP5 and a failure message.
I just added a new feature/setting to workaround the short message problem:
You just download the latest version from the first post, then set $fullMessagesMode = true;
It will fetch (in realtime) the complete message and instructions(if available) for all the messages when alerts are viewed in non-summary mode.
I also added a fine versioning number after the word BETA so you can tell if I have made slight edits or not.
$Version = ‘V2.00 01-Jun-2009 BETA .002’;
Ok thanks for the suggestions. Some installations do not have CURL, but most do. I can do a CURL check, then fall back to other way if they do not have CURL.
If anybody still has PHP4 they probably have a compromised server. They need to ask web host to upgrade their account to a server with PHP5.
New Curl version is working on my test server, but I need to adjust a few minor things and have to go out for an hour. I will upload it later.
Just uploaded the new version with CURL support. It took awhile to test all the debugging info you see if you view the source.
V2.00 01-Jun-2009 BETA .004
V2.00 01-Jun-2009 BETA .005 - added proper fail message for when an invalid advisory zone is selected.
update - protect zone value input. allowed zone = [2letters][Z][3numbers]
this is critical because the zone input determines part of the cache file names that are written on the server.
file cache improvement - cache files are never written to the server unless there is a valid zone selected or set in settings. Before it would make an empty cache file anyway.
added a code fix suggested by curly: Sometimes the word " issued" isn’t included in the entry title so it won’t explode properly to “Tornado Watch”.
added more fixes for handling invalid zones - now checks both input and default zone configuration for both syntax and actual existence of the NOAA zone. If a bogus zone is offered, it does not write any cache files and then displays “Advisory Information Unavailable, invalid advisory zone selected.”
I’m using $_REQUEST[‘summary’] = ‘Y’; on a test page (http://www.harpersferry-weather.com/wxadvisory-2009.php). There are no watches, warnings, and advisories. What is returned is a link “Source: NWS Watches, Warnings or Advisories for zone WVZ053” only. I was expecting it should return something like "There are no active watches, warnings or advisories for zone WVZ053. "
<?php
$_REQUEST['zone'] = 'WVZ053';
$_REQUEST['inc'] = 'Y';
$_REQUEST['summary'] = 'Y';
$_REQUEST['noprint'] = 1;
include 'rrs-advisory-2009.php';
if (preg_match("|There are no active|i",$advisory_html) ||
preg_match("|Advisory Information Unavailable|i",$advisory_html)) {
echo '