cloudy

Author Topic: NOAA RSS Advisory 2.0 PHP Script  (Read 29422 times)

0 Members and 1 Guest are viewing this topic.

curly

  • Guest
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #15 on: June 02, 2009, 09:12:13 PM »
Michael,
Instead of this on your page
Code: [Select]
<?php include("http://www.relayweather.com/rss-advisory-2009.php"); ?>Try this
Code: [Select]
<?php
 $_REQUEST
['zone'] = 'MDZ011';
 
$_REQUEST['inc'] = 'Y';
 
$_REQUEST['noprint'] = 1;
 include 
'rss-advisory-2009.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;
 }
?>

« Last Edit: June 02, 2009, 09:18:55 PM by curly »

mth

  • Guest
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #16 on: June 02, 2009, 09:22:40 PM »
Michael,
Instead of this on your page
Code: [Select]
<?php include("http://www.relayweather.com/rss-advisory-2009.php"); ?>Try this
Code: [Select]
<?php
 $_REQUEST
['zone'] = 'MDZ011';
 
$_REQUEST['inc'] = 'Y';
 
$_REQUEST['noprint'] = 1;
 include 
'rss-advisory-2009.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;
 }
?>


This corrected the problem.  Thanks Curly!

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #17 on: June 02, 2009, 10:32:32 PM »
V2.00 02-Jun-2009 BETA .007

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."

Various code cleanup.

Offline tstorm

  • Posts: 370
  • Harpers Ferry, WV
    • Meadowbrook Farm Weather
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #18 on: June 03, 2009, 12:25:07 AM »
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 '<div class="advisoryBoxnoactive">' .$advisory_html .'</div>';
 }else{
       echo '<div class="advisoryBox">' . $advisory_html .'</div>';
 }
?>




John

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #19 on: June 03, 2009, 12:43:08 AM »
Thanks for testing.  :D
I may have broke something in my last update.  8O
I will test it some more and let you know.

Edit: found the problem... new beta soon.
« Last Edit: June 03, 2009, 01:12:58 AM by MCHALLIS »

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #20 on: June 03, 2009, 01:29:34 AM »
All the prior beta versions had summary mode broken, this one should be better.

V2.00 02-Jun-2009 BETA .008

Fixed all reported issues:
- various issues with summary mode, fixed
- detail page link was not working, fixed

Thanks for testing and reporting errors,
everybody please keep testing. Thanks  :) :D



Offline jahuff

  • Posts: 769
  • Northern New Hampshire, USA
    • Weather Data Pittsburg, NH
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #21 on: June 03, 2009, 01:44:12 AM »
Mike,

V2.00 01-Jun-2009 BETA .008 installed and seems to be working fine.

Thanks,
John

Online ALITTLEweird1

  • Mark
  • Posts: 3,984
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #22 on: June 03, 2009, 01:59:00 AM »
Seems to work for me. No errors. Only thing im getting that is odd, is a double advisory box.

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

Good Job Mike. Thanks for your time on making a fix for this.
« Last Edit: June 03, 2009, 02:01:26 AM by ALITTLEweird1 »
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #23 on: June 03, 2009, 02:02:37 AM »
Mark, when I view your source I see this version V 1.09 25-Mar-2008, not the BETA

Online ALITTLEweird1

  • Mark
  • Posts: 3,984
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #24 on: June 03, 2009, 02:04:21 AM »
Just realized that. Fixing that now.
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #25 on: June 03, 2009, 02:21:30 AM »
yea, this is so nice I want to start using it as soon as we test it well.  :)

Online ALITTLEweird1

  • Mark
  • Posts: 3,984
  • Snoqualmie,WA
    • Snoqualmie Weather
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #26 on: June 03, 2009, 02:26:52 AM »
"Nature can do without man, but man cannot do without nature."

Davis VP2 + 1-Wire Solar + 1-wire Lightning + 1-Wire UV + Logitech Webcam

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #27 on: June 03, 2009, 03:45:59 AM »
V2.00 02-Jun-2009 BETA .010

- added a few minor formatting changes the the alert messages

abaldish

  • Guest
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #28 on: June 03, 2009, 04:03:50 AM »
Good work there mike. Playing around with it now.

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Advisory 2009 PHP Script (Beta)
« Reply #29 on: June 03, 2009, 04:12:40 AM »
Which formatting do you like better:

This?
-----------

Last updated:   Tue, 02-Jun-2009 09:26pm PDT
Effective:   Tue, 02-Jun-2009 08:44pm PDT
Expires:   Tue, 02-Jun-2009 11:00pm PDT

(Cap Codes) Urgency: Expected, Severity:, Moderate, Certainty: Likely, Status: Actual, Type: Alert, Category: Met

Or this?
--------------

Last updated:   Tue, 02-Jun-2009 09:26pm PDT
Effective:   Tue, 02-Jun-2009 08:44pm PDT
Expires:   Tue, 02-Jun-2009 11:00pm PDT

Urgency: Expected
Severity: Moderate
Certainty: Likely
Status: Actual
Type: Alert
Category: Met

My choice is the first one because it takes fewer lines.

« Last Edit: June 03, 2009, 04:15:06 AM by MCHALLIS »