Author Topic: Possible Error NWS - Alerts ---  (Read 2291 times)

0 Members and 1 Guest are viewing this topic.

Offline azkiwi

  • Senior Contributor
  • ****
  • Posts: 160
    • Maricopa, Sonoran Desert, Arizona
Possible Error NWS - Alerts ---
« on: November 23, 2015, 04:18:49 PM »
..or is it me?

Worked about 30 minutes ago, now when I open my main page - Which calls the NWS-Alerts php setup - I get this..

Warning: simplexml_load_string(): Entity: line 1: parser error : Space required after the Public Identifier in /home/content/26/9257026/html/weather/nws-alerts.php on line 830

Warning: simplexml_load_string(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /home/content/26/9257026/html/weather/nws-alerts.php on line 830

Warning: simplexml_load_string(): ^ in /home/content/26/9257026/html/weather/nws-alerts.php on line 830

Warning: simplexml_load_string(): Entity: line 1: parser error : SystemLiteral " or ' expected in /home/content/26/9257026/html/weather/nws-alerts.php on line 830

Warning: simplexml_load_string(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /home/content/26/9257026/html/weather/nws-alerts.php on line 830

Warning: simplexml_load_string(): ^ in /home/content/26/9257026/html/weather/nws-alerts.php on line 830

Warning: simplexml_load_string(): Entity: line 1: parser error : SYSTEM or PUBLIC, the URI is missing in /home/content/26/9257026/html/weather/nws-alerts.php on line 830


Anyone else experiencing this, or is something clobbered in my site?

Thanks

Ken
weather.azkiwis.net

Offline JupiterJoe

  • Senior Contributor
  • ****
  • Posts: 195
  • JupiterWX.com
    • Live Jupiter, FL Weather
Re: Possible Error NWS - Alerts ---
« Reply #1 on: November 23, 2015, 04:33:06 PM »
Me too. Only more! Ack!!

Offline satcop

  • Senior Contributor
  • ****
  • Posts: 241
    • Clifton Virginia Weather
Re: Possible Error NWS - Alerts ---
« Reply #2 on: November 23, 2015, 04:35:34 PM »
I am too, started within the hour.
Clifton, Virginia Weather


Blitzortung Stations 1189, 1451 - CWOP EW1675

Offline satcop

  • Senior Contributor
  • ****
  • Posts: 241
    • Clifton Virginia Weather
Re: Possible Error NWS - Alerts ---
« Reply #3 on: November 23, 2015, 04:51:55 PM »
Things seem to be back to normal again, probably an issue at NWS. :?

Bob
Clifton, Virginia Weather


Blitzortung Stations 1189, 1451 - CWOP EW1675

Offline azkiwi

  • Senior Contributor
  • ****
  • Posts: 160
    • Maricopa, Sonoran Desert, Arizona
Re: Possible Error NWS - Alerts ---
« Reply #4 on: November 23, 2015, 05:33:08 PM »
Mine looks to either still be there, or back.

I'm hosted on Godaddy,  wonder if they've done some nasty stuff....

Ken

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: Possible Error NWS - Alerts ---
« Reply #5 on: November 23, 2015, 06:00:06 PM »
KEN
I ran the script and got a "Not Found" 404 on the zone URL at the NWS.
Ran it again and it displayed...  Two minutes later the link was "Not Found" again.

JUPITERJOE
The alert links all check out with the NWS.  They finally took after a few minutes.

Something is definitely happening at the NWS. Since this is currently a random issue going, all I can suggest is to wait it out.


Offline azkiwi

  • Senior Contributor
  • ****
  • Posts: 160
    • Maricopa, Sonoran Desert, Arizona
Re: Possible Error NWS - Alerts ---
« Reply #6 on: November 23, 2015, 06:03:54 PM »
Thank you Curly -- Appreciate it.

Will worry about it tomorrow..

Ken

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: Possible Error NWS - Alerts ---
« Reply #7 on: November 23, 2015, 06:12:52 PM »
I believe this may get rid of the errors.
Open nws-alerts.php
Find these lines:
Code: [Select]
      if(!$zData = get_nwsalerts($priURL.$cds[0][$i])) {                         //     IF can't get  preliminary URL
        $noted .= "<!-- First attempt in getting preliminary URL failed -->\n";  //       create note
        sleep(.5);                                                               //       wait a half second
        if($zData = get_nwsalerts($priURL.$cds[0][$i])) {                        //       IF URL cull was successful

Replace those lines with these:
Code: [Select]
      if(!$zData = simplexml_load_string(get_nwsalerts($priURL.$cds[0][$i]))) {                         //     IF can't get  preliminary URL
        $noted .= "<!-- First attempt in getting preliminary URL failed -->\n";  //       create note
        sleep(.5);                                                               //       wait a half second
        if(!$zData = simplexml_load_string(get_nwsalerts($priURL.$cds[0][$i]))) {                        //       IF URL cull was successful


NEXT
Find this line and delete it:
Code: [Select]
  $data = simplexml_load_string($data);
Save the file and upload it.
Next you will have to run the script.
yourwebsite.com/nws-alerts.php

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: Possible Error NWS - Alerts ---
« Reply #8 on: November 23, 2015, 06:21:57 PM »
It's now getting bazaar

I'm getting the 404's on my site now.
When I went to the NWS alert page to view the original source, some of them were not complete pages and the XML is corrupted.
A few minutes later, the script performed without errors.

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 951
    • LexMAWeather
Re: Possible Error NWS - Alerts ---
« Reply #9 on: November 23, 2015, 06:33:11 PM »
Just a "me too" to add.  Will try Curly's mods above.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 951
    • LexMAWeather
Re: Possible Error NWS - Alerts ---
« Reply #10 on: November 23, 2015, 06:41:04 PM »
Bummer.  After that mod, I get the same error starting on the simplexml_load_string() call within the changed "if" line.

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Space required after the Public Identifier in /home/jjwebsit/public_html/weather/nws-alerts.php on line 144

I'll dig in to it a little more but if anyone knows what the deal is with the bad data from NWS and how to detect it, please share...
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: Possible Error NWS - Alerts ---
« Reply #11 on: November 23, 2015, 06:44:12 PM »
Would you consider upgrading to the latest version that fixes this issue?

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 951
    • LexMAWeather
Re: Possible Error NWS - Alerts ---
« Reply #12 on: November 23, 2015, 06:54:43 PM »
If you want someone to give it a test drive, sure.

FWIW anyone seeing the errors waiting for a fix can temporarily add

Code: [Select]
error_reporting(E_ALL ^ E_WARNING);

just after the opening comments in nws_alerts.php.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline azkiwi

  • Senior Contributor
  • ****
  • Posts: 160
    • Maricopa, Sonoran Desert, Arizona
Re: Possible Error NWS - Alerts ---
« Reply #13 on: November 23, 2015, 06:56:54 PM »
Curly --  is there a 'latest' version?  on the saratoga site?

I'll look at it tonight when I get home..

Thanks

Ken

Offline satcop

  • Senior Contributor
  • ****
  • Posts: 241
    • Clifton Virginia Weather
Re: Possible Error NWS - Alerts ---
« Reply #14 on: November 23, 2015, 06:59:19 PM »
arggh it has returned here as well, suspect that NWS is doing some work.  Curly, from the timing of the replies, I suspect that the earlier suggested fix didn't work? I too would be willing to give a new version a whirl.  In the meantime will put in the error masker.

Bob
Clifton, Virginia Weather


Blitzortung Stations 1189, 1451 - CWOP EW1675

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 951
    • LexMAWeather
Re: Possible Error NWS - Alerts ---
« Reply #15 on: November 23, 2015, 07:11:17 PM »
Nice clean XML coming back from NWS for me right now. Will monitor...
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: Possible Error NWS - Alerts ---
« Reply #16 on: November 23, 2015, 07:18:05 PM »
This is the latest version but it has several more options that are controlled by settings added in the config page.
After a quick test with the older config file settings, everything worked as expected.

First, back up your current nws-alerts.php file.
Download the main file, unzip it and then upload it. You will have to run the script to update files and this is where you will see errors or not. If the page is blank, it's working! You can view the page source to see what actually happened when the script ran.
If that errors out, then the complete package may need to be updated but I would like to see the errors before you take on this complete update.

http://www.weather.ricksturf.com/scripts/nws-alerts_131_main.zip

« Last Edit: November 23, 2015, 07:31:38 PM by Curly »

Offline weatherforyou

  • Forecaster
  • *****
  • Posts: 545
  • My weather is on WeatherForYou.com. Is yours?
    • http://www.weatherforyou.com
Re: Possible Error NWS - Alerts ---
« Reply #17 on: November 23, 2015, 07:23:06 PM »
Well... it's better.  Now I'm only getting one error at the top of the page...

Warning: Cannot modify header information - headers already sent by (output started at /xxxx/xxxx/xxxx/top.php:57) in /xxxx/xxxx/xxxx/nws-alerts.php on line 54
Joe Torsitano


Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: Possible Error NWS - Alerts ---
« Reply #18 on: November 23, 2015, 07:28:04 PM »
Open nws-alerts.php and delete these two lines:
Code: [Select]
// set character encoding
header("Content-type: text/html; charset=ISO-8859-1");

« Last Edit: November 23, 2015, 07:41:22 PM by Curly »

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 951
    • LexMAWeather
Re: Possible Error NWS - Alerts ---
« Reply #19 on: November 23, 2015, 07:42:34 PM »
I'm not getting the errors with the old script at this point in time, but I have the new code uploaded as nws-alerts-new.php and I can run that and report back if I start seeing the errors again.

Anyone who is still seeing the errors: what NWS codes are you using? I could plug one of those for a test.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline satcop

  • Senior Contributor
  • ****
  • Posts: 241
    • Clifton Virginia Weather
Re: Possible Error NWS - Alerts ---
« Reply #20 on: November 23, 2015, 07:46:50 PM »
Have new version running, not seeing errors but could be because NWS is behaving for the moment.  Will monitor, thanks Curly.

Bob
Clifton, Virginia Weather


Blitzortung Stations 1189, 1451 - CWOP EW1675

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: Possible Error NWS - Alerts ---
« Reply #21 on: November 23, 2015, 07:52:36 PM »
I'm using 14 codes and it's a hit and miss with all of them.
Sometimes all downloads are successful. About once every 10 minutes.

You can even see this happening at these links  http://alerts.weather.gov/

Offline tshattuck

  • Forecaster
  • *****
  • Posts: 337
    • Your Local Weather - Clay, NY
Re: Possible Error NWS - Alerts ---
« Reply #22 on: November 23, 2015, 11:54:43 PM »
Folks:
I have noticed over the last couple of days the PHP script for NWS Alerts is not always updating. I have seen instances where it didn't update for over an hour. I haven't seen any error messages on my web pages, it just doesn't update. How do I check for errors?

Is the NWS changing how they broadcast their Watches and Warnings and if so does the PHP script need to be revised?

Regards,

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 951
    • LexMAWeather
Re: Possible Error NWS - Alerts ---
« Reply #23 on: November 24, 2015, 07:57:56 AM »
I'm inferring from a re-read of the thread that at times the NWS was returning a 404 error (not found) for particular codes. In that case, it will return HTML instead of XML - the error messages indicate that it was getting an HTML header: "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">".

Curly, is this the error case the new code handles correctly?

To see this yourself, try a bogus URL like:

Code: [Select]
http://alerts.weather.gov/cap/get.php
and then look at the source that is returned (vs the XML source on a good "get").
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 951
    • LexMAWeather
Re: Possible Error NWS - Alerts ---
« Reply #24 on: November 26, 2015, 09:16:09 PM »
Hey Curly - thought I'd throw this out there even though it is tangential to the original question.

I tried the new nws-alerts.php. The old version of the code has $logAlerts set in nws-alerts-config.php but it is never used in nws-alerts.php. The new version of this file does use it but also expects $log_folder to be set (otherwise it tries to write in the "/" directory. In any case, the code runs correctly but displays a file open error for me.

The old code for some reason will not pick up a current special statement for fog but the new one does. Rather than figure it out I just shut off $logAlerts and am now using the new code.

Maybe we should start a different thread about getting the new code all integrated into the Saratoga release?
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

 

anything