Author Topic: WU-forecast.php V3.00 available -- requires WU API key to operate  (Read 11246 times)

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 156
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
It was about a 60% rewrite of the old script to allow use/cache of the WeatherUnderground API calls for forecast info, but it's now finished.

Before you install, make sure you have registered for a Developer API key at http://www.wunderground.com/weather/api/
You'll need to be a member of WeatherUnderground (but you already should be a member if you were using the prior script).  Get your key from the page listed above.

Standalone users: Download from the script page which has updated documentation.
Enter your key in
Code: [Select]
$WUAPIkey = 'specify-for-standalone-use-here'; in the script.

Saratoga template users: Use the Updates tool to get your update. (Base-World, Plugin-*, 31-Oct-2014)
Add a line to your Settings.php with
Code: [Select]
$SITE['WUAPIkey'] = 'specify-your-api-key-here';
then save and upload Settings.php, then upload the WU-forecast.php.

Major changes:
1) the script will parse your existing WU page URLs and should create valid API query strings, so your existing settings should work as before -- the data will be from the API instead of the page being scraped.
2) the cache file names have changed to add a -json in them so there is no interference with old page cache files.
3) you can now select for metric (C,km/s,hPa,mm) or imperial (F,mph,inHg,in) units for the forecast icons and text.  Sorry, there is no mix-n-match capability.  It is all of one or the other.
4) the day name issue should be fully resolved .. at least it was when I checked tonight.
5) the Africaans, Gaelic and Bulgarian forecasts are in English .. it's a WU issue as the script does no translations, but
  relies on WU for all of that.

Enjoy...

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

jf-i2r

  • Strong Breeze
  • ***
  • Posts: 150
  • Station Details: vantage pro2 wireless with solar sensor ; weatherlink-ip ;mac mini 1,6ghz 2go ram El Capitan
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #1 on: November 01, 2014, 09:04:20 AM »
thanks Ken all is ok for me  [tup]

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 156
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #2 on: November 01, 2014, 02:09:43 PM »
I found that I had omitted the logic for standalone use non-English language default selection ..

The V3.01 script is now available, and if $lang= is set in the script, that will be the default language for all forecasts.

After the update of the script, the cache may still hold the old English .. add ?force=1 to the URL to cause the cache to refresh with the new default language.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

jf-i2r

  • Strong Breeze
  • ***
  • Posts: 150
  • Station Details: vantage pro2 wireless with solar sensor ; weatherlink-ip ;mac mini 1,6ghz 2go ram El Capitan
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #3 on: November 01, 2014, 03:42:53 PM »
hi ken

$lang = 'fr';   // défaut language

 [tup]

cheers
jean fred

wurzelmac

  • Storm
  • *****
  • Posts: 1361
    • ITIROLPR2
    • Wetterstation Pr?graten am Gro?venediger
  • Station Details: Davis Vantage PRO2 Plus (24h fan aspirated, wireless) with UV/Solar | Weather Envoy Data Logger | Mac mini 2023 M2 8/256 | 1x Canon EOS 1300D | macOS Sonoma 14.2
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #4 on: November 01, 2014, 08:14:32 PM »
Thank you, Ken - played around with this for me "new toy" today a bit and I am impressed what someone could do with your script and a little html-experience!

Cheers,
Reinhard
Reinhard


saratogaWX

  • Strong Breeze
  • ***
  • Posts: 156
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #5 on: November 01, 2014, 10:29:23 PM »
Thanks for the kind words, Reinhard :)

Some problems were encountered using WU URL formats I was not aware of before...  I've added handling of those types into the V3.02 version of the script.

Now URLs with queries like:

/q/locid:UKEN1390
/cgi-bin/findweather/getForecast?query=zmw:00000.1.03749
/q/zmw:00000.6.06280
/US/HI/Honolulu.html
/global/ML.html

are handled now too.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

jf-i2r

  • Strong Breeze
  • ***
  • Posts: 150
  • Station Details: vantage pro2 wireless with solar sensor ; weatherlink-ip ;mac mini 1,6ghz 2go ram El Capitan
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #6 on: November 02, 2014, 08:17:26 AM »
hi ken

no problems for me and WU URL and V3.01

http://www.jf-i2r.com/wxforecast.php

best regards
jean fred

marzio2515

  • Gentle Breeze
  • **
  • Posts: 24
    • IMARCHEU3
  • Station Details: WeaherHawk 600 series
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #7 on: January 12, 2015, 07:03:05 PM »
Hi Guys...
i'm having some troubles with WU-forecast.php, in the main screen i got the errors show in the attached files...
that's what  i did
1) edit the WU-forecast and setting this line to point to my WU station address on Weather Underground:
                        $WU_URL = 'http://www.wunderground.com/q/zmw:00000.47.16179';(that's my station address on W.U web site)

2)edit Settings.php as the  following:

               $SITE['fcsturlWU']= 'http://www.wunderground.com/q/zmw:00000.47.16179'; // Urbania, Italy(again my W.U. Station Address)
               
               $SITE['WUforecasts'] = array(
                 // Location|forecast-URL  (separated by | characters
               'Urbania|http://www.wunderground.com/q/zmw:00000.47.16179', // Urbania, Italy
               etc... etc.... the other town and county .... etc....
                   )
in the array i put my station as the first entry

but anyway i can't retrieve weather forecast for my location... instead i got the error shown in the attached file

i'm using WeatherCat 2.0.2 and the last World-Base script and plugin (the WU-forecast is the 3.0.2)

any help/suggestion ???

marzio2515

  • Gentle Breeze
  • **
  • Posts: 24
    • IMARCHEU3
  • Station Details: WeaherHawk 600 series
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #8 on: January 12, 2015, 07:06:21 PM »
i forgot telling i also add these line to my Settings.php
$SITE['WUAPIkey'] = '9ed97e8648b81534';

any help is appreciate...

Thanks
Marzio

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 156
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #9 on: January 12, 2015, 07:10:01 PM »
Marzio,

To diagnose the issue, it would be really helpful to have the URL to your website.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

marzio2515

  • Gentle Breeze
  • **
  • Posts: 24
    • IMARCHEU3
  • Station Details: WeaherHawk 600 series
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #10 on: January 12, 2015, 08:03:37 PM »
first:
http://www.urbaniameteo.it

then:
choose : "Dati Completi" on the left hand menu and u will be on the saratoga main screen (sometimes u got the error on this main page)

otherwise you can choose on the left "Nav Menu" -->"previsioni & dettagli" --> "dettagli previsionali" and you can see the error

thanks
Marzio
 

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 156
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #11 on: January 12, 2015, 08:13:25 PM »
WeatherUnderground is responding to your query with
Code: [Select]
{
  "response": {
  "version":"0.1",
  "termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
  "features": {
  }
,
"error": {
"type": "keynotfound"
,"description": "this key does not exist"
}
}
}

I suspect that the WUAPIkey is not correct and that is why you're not getting a forecast.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

marzio2515

  • Gentle Breeze
  • **
  • Posts: 24
    • IMARCHEU3
  • Station Details: WeaherHawk 600 series
Re: WU-forecast.php V3.00 available -- requires WU API key to operate
« Reply #12 on: January 12, 2015, 08:35:00 PM »
Thanks Ken, now it works.... i updated my key on WU web site!!

Thanks Again...!!

Marzio