Page 1 of 3

WU-forecast.php

Posted: Tue Nov 07, 2017 11:04 pm
by Toxic17
Looks like WU API data is now returning fcttext_metric = null and showing an error. this appears to be some city's but not all as mentioned here:

https://apicommunity.wunderground.com/w ... 5-november

Re: WU-forecast.php

Posted: Tue Nov 07, 2017 11:23 pm
by saratogaWX
Yes, that is what is 'confusing' the WU-forecast.php V3.03 script -- the missing 'fcttext_metric' entry in the JSON returned.

I've got a beta workaround (v3.04-beta) that uses the 'fcttext' (Imperial) text forecast and (tries to) replace the F forecasts with C forecasts leaving the rest of the forecast text unchanged. It doesn't try to change the wind forecasts from MPH to km/h, and I've observed that some international forecasts using languages other than that country's language may have null values for both (and so fail).

Try if you like the attached beta .. I'm not releasing an 'offical' update for this as it's just a quick workaround for their broken API JSON feed.

Re: WU-forecast.php

Posted: Tue Nov 07, 2017 11:26 pm
by Toxic17
Thanks :clap:

Re: WU-forecast.php

Posted: Wed Nov 08, 2017 11:09 pm
by Mapantz
I think they've fixed it now? My forecast has been on/off all day, for the last 4 days I think?! One hour it's fine, then it's down for an hour etc However, it has been working fine for the last 5 or 6 hours.

Re: WU-forecast.php

Posted: Wed Nov 08, 2017 11:54 pm
by Toxic17
Mapantz wrote:I think they've fixed it now? My forecast has been on/off all day, for the last 4 days I think?! One hour it's fine, then it's down for an hour etc However, it has been working fine for the last 5 or 6 hours.


Yep got an email from the api team reporting the issue is now fixed.

Re: WU-forecast.php

Posted: Wed Nov 15, 2017 5:22 pm
by Toxic17
is this broken again?

I'm getting error mesdsage:

Warning: Division by zero in WU-forecast.php on line 631

WU-forecast-json-0-en.txt is zero bites so looks like no data is being downloaded.

Re: WU-forecast.php

Posted: Wed Nov 15, 2017 5:44 pm
by saratogaWX
Doing a view-source on wxforecast.php?force=1 shows
<!-- WU-forecast.php (ML) Version 3.04 beta - 22-Feb-2017 on PHP 7.1.11 -->
<!-- temps in C -->
<!-- autoSetTemplate using narrow aspect. -->
<!-- WU_API Raw URL='https://www.wunderground.com/cgi-bin/findweather/getForecast?query=pws:ICODOWNN2' -->
<!-- WU API New URL='http://api.wunderground.com/api/47678e7793e1cea8/forecast10day/geolookup/lang:EN/q/pws:ICODOWNN2.json' -->
<!-- loading from https://api.wunderground.com/api/47678e ... OWNN2.json. -->
<!-- curl fetching 'https://api.wunderground.com/api/47678e7793e1cea8/forecast10day/geolookup/lang:EN/q/pws:ICODOWNN2.json' -->
<!-- Error: Operation timed out after 4001 milliseconds with 0 out of 0 bytes received -->
<!-- HTTP stats: RC=0 dest=23.43.34.106 port=443
Times: dns=0.060 conn=0.062 pxfer=0.000 get=4.001 total=4.001 secs -->

So there's a timeout issue between your webserver and api.wunderground.com server -- WU is not responding within 4 seconds (a long time for an API) and zero results are received.

A 'normal' fetch (as on my site currently) shows
<!-- WU-forecast.php (ML) Version 3.03 - 22-Feb-2017 on PHP 7.1.11 -->
<!-- temps in F -->
<!-- autoSetTemplate using narrow aspect. -->
<!-- WU_API Raw URL='http://www.wunderground.com/cgi-bin/findweather/hdfForecast?query=95070' -->
<!-- WU API New URL='http://api.wunderground.com/api/c991975b7f4186c0/forecast10day/geolookup/lang:EN/q/95070.json' -->
<!-- loading from https://api.wunderground.com/api/c99197 ... 95070.json. -->
<!-- curl fetching 'https://api.wunderground.com/api/c991975b7f4186c0/forecast10day/geolookup/lang:EN/q/95070.json' -->
<!-- HTTP stats: RC=200 dest=23.52.163.36
Times: dns=0.013 conn=0.051 pxfer=0.215 get=0.271 total=0.486 secs -->
<!-- RC=200 OK, bytes=26180 -->

Re: WU-forecast.php

Posted: Wed Nov 15, 2017 6:19 pm
by Toxic17
Ah.. ok might be my firewall slowing the request I'll take a look.. thanks.

Re: WU-forecast.php

Posted: Wed Nov 15, 2017 8:31 pm
by Toxic17
saratogaWX wrote:So there's a timeout issue between your webserver and api.wunderground.com server -- WU is not responding within 4 seconds (a long time for an API) and zero results are received.

A 'normal' fetch (as on my site currently) shows
<!-- WU-forecast.php (ML) Version 3.03 - 22-Feb-2017 on PHP 7.1.11 -->


Thank god for Backups... :lol:

disabled all firewall, IPS, Web and Application rules, but still no joy.

played about with the WU-forecast.php but could not figure it out. restarted apache. still no joy, though my PC (win10) calls the api url within a split second.

ended up restoring the webfolder from a backup. and it is now working. so something in the configuration was screwed up. :groan:

Thanks for the help though Ken. :clap:

Re: WU-forecast.php

Posted: Fri Nov 24, 2017 10:00 pm
by Mapantz
It looks like it is back to playing up again! :(

Re: WU-forecast.php

Posted: Fri Nov 24, 2017 10:32 pm
by saratogaWX
Looks like it's working again on your site.

When it fails, do a view-source on the page
<!-- WU-forecast.php (ML) Version 3.02 - 01-Nov-2014 on PHP 5.6.32 -->
<!-- WU_API Raw URL='https://www.wunderground.com/q/zmw:00000.70.03862' -->
<!-- WU API New URL='http://api.wunderground.com/api/f7ca74754ae07fca/forecast10day/geolookup/lang:EN/q/zmw:00000.70.03862.json' -->
<!-- loading from ./cache/WU-forecast-json-0-en.txt (26136 bytes) -->
<!-- using charsetInput='UTF-8' charsetOutput='ISO-8859-1' doIconv='1' doRTL='' -->
<!-- processing JSON entries for forecast -->
<!-- rawJSON size is 25684 bytes -->
<!-- WU_prepareJSON: Success. Valid UTF-8. -->
<!-- json_decode returns - No errors -->

to see what it said. If needed, look at the cached JSON file highlighted above to see if forecast info was included. WU sometimes omits the forecast JSON info while their models update the detailed forecasts. It happens with our NWS and the new api.weather.gov site also.

Re: WU-forecast.php

Posted: Fri Nov 24, 2017 11:07 pm
by Toxic17
I used to get sometimes a 0 byte files json file, and then it would not update at all. I have added a check for 0 byte and if so delete this file before it refreshes. still does not stop incomplete files however.

Re: WU-forecast.php

Posted: Sat Nov 25, 2017 2:05 am
by Mapantz
It went blank again..

Code: Select all

<!-- WU-forecast.php (ML) Version 3.03 - 22-Feb-2017 on PHP 5.6.32 -->
<!-- loading from https://api.wunderground.com/api/f7ca74754ae07fca/forecast10day/geolookup/lang:EN/q/zmw:00000.70.03862.json. -->
<!-- curl fetching 'https://api.wunderground.com/api/f7ca74754ae07fca/forecast10day/geolookup/lang:EN/q/zmw:00000.70.03862.json' -->
<!-- HTTP stats:  RC=200 dest=213.248.117.32 port=443 (from sce=185.145.203.195)
      Times: dns=0.028 conn=0.029 pxfer=0.038 get=0.648 total=0.685 secs -->
<!-- RC=200 OK, bytes=24485 -->
<!-- saved cache to ./cache/WU-forecast-json-0-en.txt (24485 bytes) -->
<!-- using charsetInput='UTF-8' charsetOutput='ISO-8859-1' doIconv='1' doRTL='' -->
<!-- processing JSON entries for forecast -->
<!-- rawJSON size is 24027 bytes -->
<!-- json_decode returns  - No errors

Re: WU-forecast.php

Posted: Sat Nov 25, 2017 9:54 am
by Toxic17
In the last few months it had been very hit and miss. Not sure it they are to blame or not.

Just double check your DNS and time are pretty much 100% ok and nothing your end (network related) is making the data truncated at all. I think I did move DNS from Google to OpenDNS which seems slightly faster with my ISP. My time is pulled from uk.pool.ntp.org.

Re: WU-forecast.php

Posted: Sat Nov 25, 2017 3:48 pm
by Mapantz
Toxic17 wrote:In the last few months it had been very hit and miss. Not sure it they are to blame or not.

Just double check your DNS and time are pretty much 100% ok and nothing your end (network related) is making the data truncated at all. I think I did move DNS from Google to OpenDNS which seems slightly faster with my ISP. My time is pulled from uk.pool.ntp.org.


I checked your forecast last night, and it wasn't working either.

https://apicommunity.wunderground.com/w ... 5-november

A few people complained about it yesterday.