Page 1 of 1

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: