Author Topic: NWS Forecast Feed Broke  (Read 14924 times)

0 Members and 1 Guest are viewing this topic.

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: NWS Forecast Feed Broke
« Reply #50 on: March 31, 2015, 10:25:04 PM »
I changed the code on my page and still had nothing until I force an update then everything is fine BUT if I shut down the browser and cache is cleared I have to force update once again. What did I mess up  :-P   

Here is the page  http://www.smythweather.net/wxforecast.php

I'm sure I overlooked something simple as that is the way it usually ends up LOL!

Thanks

Works fine on this end.




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Forecast Feed Broke
« Reply #51 on: March 31, 2015, 10:32:00 PM »
EDIT... to include the proper attachment.

I'm using an old version of the wxNWSpns.php script that quit working today along with the rest.  This one has the drop-down menu to chose which office you wish to view.

The script is attached.  Can it be patched?
That does seem to be an old script.. the code that accesses the NWS seems to be
Code: [Select]
$html = implode('',  file($noaasr));
$html2 = implode('', file($noaasr));
although, it is a bit strange to get the same data twice.
Nevertheless, the file() function in PHP will see the 'http://' and attempt to connect and read the contents of the URL into an array, which the implode() converts to a string.

It may be as simple as adding a stream_context to the request so that the Akamai gods would be satisfied this is a proper request.

Try changing the code to
Code: [Select]
$opts = array(
  'http'=>array(
    'method'=>"GET",
'protocol_version' => 1.1,
    'header'=>"Cache-Control: no-cache, must-revalidate\r\n" .
          "Cache-control: max-age=0\r\n" .
"Connection: close\r\n" .
"User-agent: Forecast loader\r\n" .
"Accept: text/plain,text/html\r\n"
  )
);

$context = stream_context_create($opts);
$html = implode('',  file($noaasr,0,$context));
// $html2 = implode('', file($noaasr));
$html2 = $html;
and that should work (it did on my local system) :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Mark / Ohio

  • Live from Mars!
  • Forecaster
  • *****
  • Posts: 2511
    • Fairfield County Weather
Re: NWS Forecast Feed Broke
« Reply #52 on: March 31, 2015, 11:57:44 PM »
Thanks Ken!  Forecast back up and running.   :grin:
Mark 
2002 Davis VP I Wireless, WeatherLink (Serial), GRLevel3, VirtualVP, StartWatch, Weather Display, Windows 10


Offline W Thomas

  • Welcome to my area!
  • Forecaster
  • *****
  • Posts: 1643
  • In Loving Memory Of Hooker The Weather Dog !
    • Smyth-Grayson Weather
Re: NWS Forecast Feed Broke
« Reply #53 on: March 31, 2015, 11:59:29 PM »
I changed the code on my page and still had nothing until I force an update then everything is fine BUT if I shut down the browser and cache is cleared I have to force update once again. What did I mess up  :-P   

Here is the page  http://www.smythweather.net/wxforecast.php

I'm sure I overlooked something simple as that is the way it usually ends up LOL!

Thanks

Works fine on this end.

Well dang!  I'm not sure what's going on then cause I just loaded it here and the forecast is blank but I can force a reload and it's good to go till next round. Whatever happened just happened when the NWS changed their way of doing things.. Guess I'll dig a little further :)


     Best Regards
     Wayne

CWOP CW8217
KVAWHITE22 Wunderground   Davis VUE &  Davis Vantage Pro 2  /   Dedicated Server
GR Level 3 ,Level 2 AE Radars  Weather Display 10.37P  Mid Atlantic Weather Network Member
SkyWarn & Spotter Network 6092

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: NWS Forecast Feed Broke
« Reply #54 on: April 01, 2015, 12:09:16 AM »
Tried on my cell phone and tablet and it appeared fine. Nice site too.




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline W Thomas

  • Welcome to my area!
  • Forecaster
  • *****
  • Posts: 1643
  • In Loving Memory Of Hooker The Weather Dog !
    • Smyth-Grayson Weather
Re: NWS Forecast Feed Broke
« Reply #55 on: April 01, 2015, 12:13:55 AM »
Thanks for the nice comments about my site!  Well, must be on my end somehow. I'm using FireFox and CCleaner Pro clears cache each shut down so I guess I better look and see what cookies are there that didn't use to be and maybe that will give me a direction :)


     Best Regards
     Wayne

CWOP CW8217
KVAWHITE22 Wunderground   Davis VUE &  Davis Vantage Pro 2  /   Dedicated Server
GR Level 3 ,Level 2 AE Radars  Weather Display 10.37P  Mid Atlantic Weather Network Member
SkyWarn & Spotter Network 6092

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: NWS Forecast Feed Broke
« Reply #56 on: April 01, 2015, 12:22:16 AM »




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline Mark / Ohio

  • Live from Mars!
  • Forecaster
  • *****
  • Posts: 2511
    • Fairfield County Weather
Re: NWS Forecast Feed Broke
« Reply #57 on: April 01, 2015, 12:43:13 AM »
Came up OK for me Wayne without forcing it.  Running Firefox 36.0.4   8-)
Mark 
2002 Davis VP I Wireless, WeatherLink (Serial), GRLevel3, VirtualVP, StartWatch, Weather Display, Windows 10


Offline W Thomas

  • Welcome to my area!
  • Forecaster
  • *****
  • Posts: 1643
  • In Loving Memory Of Hooker The Weather Dog !
    • Smyth-Grayson Weather
Re: NWS Forecast Feed Broke
« Reply #58 on: April 01, 2015, 01:05:24 AM »
Mark,Ryan Thanks for checking this out for me! It evidently was something to do with Ccleaner and the way I have it set to clear all browser data on close. I just added my site's cookie to the keep list and it works :)   Kinda screwey since it has been fine everywhere else but then again I did do a overhaul over the weekend with a new CPU and motherboard so maybe that is where by goofiness lies  :-P

Thanks to you both!



     Best Regards
     Wayne

CWOP CW8217
KVAWHITE22 Wunderground   Davis VUE &  Davis Vantage Pro 2  /   Dedicated Server
GR Level 3 ,Level 2 AE Radars  Weather Display 10.37P  Mid Atlantic Weather Network Member
SkyWarn & Spotter Network 6092

Offline W Thomas

  • Welcome to my area!
  • Forecaster
  • *****
  • Posts: 1643
  • In Loving Memory Of Hooker The Weather Dog !
    • Smyth-Grayson Weather
Re: NWS Forecast Feed Broke
« Reply #59 on: April 01, 2015, 03:11:21 AM »
Ok ,
I have uncovered what is happening but I can't determine why it is happening.
Using the regular  http://www.smythweather.net/wxforecast.php  it will not display a forecast UNLESS the page has been fore updated within the 30 minute time period for fetches. But if I add ?force=1 to the call it will obviously cause a forced update and everything is fine.

I changed the rime from 5 seconds to 10 within the script code just to see if the connection may be lagging and causing a timeout prior to loading but as expected that didn't cause any good results.

I have searched the code several times but didn't find anything missing or additional to Ken's original latest version..but my untrained and somewhat blind at time eyes could have easily missed an important element ! So basically I am issuing a "Cry For Help" advisory effective immediately  :-P   Thanks in advance for any help, suggestions or otherwise  :lol:


     Best Regards
     Wayne

CWOP CW8217
KVAWHITE22 Wunderground   Davis VUE &  Davis Vantage Pro 2  /   Dedicated Server
GR Level 3 ,Level 2 AE Radars  Weather Display 10.37P  Mid Atlantic Weather Network Member
SkyWarn & Spotter Network 6092

Offline tmabell

  • Forecaster
  • *****
  • Posts: 394
    • Mishawaka Weather
Re: NWS Forecast Feed Broke
« Reply #60 on: April 01, 2015, 05:44:37 AM »
Thanks Ken!!  The PNS script is working again with your change. 

Offline colonieweather

  • Contributor
  • ***
  • Posts: 143
    • Colonie Weather Online
Re: NWS Forecast Feed Broke
« Reply #61 on: April 01, 2015, 05:55:23 AM »
EDIT... to include the proper attachment.

I'm using an old version of the wxNWSpns.php script that quit working today along with the rest.  This one has the drop-down menu to chose which office you wish to view.

The script is attached.  Can it be patched?
That does seem to be an old script.. the code that accesses the NWS seems to be
Code: [Select]
$html = implode('',  file($noaasr));
$html2 = implode('', file($noaasr));
although, it is a bit strange to get the same data twice.
Nevertheless, the file() function in PHP will see the 'http://' and attempt to connect and read the contents of the URL into an array, which the implode() converts to a string.

It may be as simple as adding a stream_context to the request so that the Akamai gods would be satisfied this is a proper request.

Try changing the code to
Code: [Select]
$opts = array(
  'http'=>array(
    'method'=>"GET",
'protocol_version' => 1.1,
    'header'=>"Cache-Control: no-cache, must-revalidate\r\n" .
          "Cache-control: max-age=0\r\n" .
"Connection: close\r\n" .
"User-agent: Forecast loader\r\n" .
"Accept: text/plain,text/html\r\n"
  )
);

$context = stream_context_create($opts);
$html = implode('',  file($noaasr,0,$context));
// $html2 = implode('', file($noaasr));
$html2 = $html;
and that should work (it did on my local system) :)

Best regards,
Ken

Thanks so much Ken!  That did the trick.  I also did the same on my LSR page.

-Chris
Davis Vantage Pro 2 Plus
WeatherLink v6.0.5
colonieweatheronline.com
Wx Underground - KNYCOLON3
APRS/CWOP - EW0288

Offline Jed42

  • Member
  • *
  • Posts: 36
Re: NWS Forecast Feed Broke
« Reply #62 on: April 01, 2015, 06:37:36 AM »
Thanks again, Ken!!! =D>

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4107
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: NWS Forecast Feed Broke
« Reply #63 on: April 01, 2015, 09:38:45 AM »
I fixed mine late last night, I was glad that I saw the issue and this thread. At the risk of yet another "me too", Thanks Ken! =D>

Greg H.


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline Russell797

  • Senior Member
  • **
  • Posts: 81
    • Lowell Highlands Weather
Re: NWS Forecast Feed Broke
« Reply #64 on: April 01, 2015, 11:08:17 AM »
Same here, thanks Ken....
Lowell Highlands Current Weather Conditions


Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: NWS Forecast Feed Broke
« Reply #65 on: April 07, 2015, 11:47:11 AM »
As always, thanks so much, Ken!  UU
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline Mark / Ohio

  • Live from Mars!
  • Forecaster
  • *****
  • Posts: 2511
    • Fairfield County Weather
Re: NWS Forecast Feed Broke
« Reply #66 on: April 07, 2015, 09:09:08 PM »
As always, thanks so much, Ken!  UU

Nothing like a broken script to bring some of us old timers like myself back to the forum to see what happened and what needs done to fix it.   ;)  How have you been doing Kevin?   :grin: 
Mark 
2002 Davis VP I Wireless, WeatherLink (Serial), GRLevel3, VirtualVP, StartWatch, Weather Display, Windows 10


Offline sam2004gp

  • Mount Crawford, Virginia
  • Forecaster
  • *****
  • Posts: 2865
  • Weeeeeeeee!!!!
    • Mount Crawford Weather, VA
Re: NWS Forecast Feed Broke
« Reply #67 on: April 08, 2015, 04:54:40 PM »
As always, thanks so much, Ken!  UU

Nothing like a broken script to bring some of us old timers like myself back to the forum to see what happened and what needs done to fix it.   ;)  How have you been doing Kevin?   :grin:

Ditto here.  :-)
SAM --->>> http://www.mountcrawfordweather.org
OS WMR-968 with a Dedicated PWS Weather Computer running VWS v13.01 p09


Online PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: NWS Forecast Feed Broke
« Reply #68 on: April 08, 2015, 10:33:13 PM »
Hi Mark / Sam.  Great to see the old timers early pioneers still following here.

Paul