Author Topic: WU's XML Download  (Read 2760 times)

0 Members and 1 Guest are viewing this topic.

Offline Flying_German

  • Red sky in morning, pilot's warning.
  • Member
  • *
  • Posts: 20
WU's XML Download
« on: June 03, 2017, 11:21:26 AM »
I noticed that under "About this PWS" you can download two different XML Files.
Current Conditions and Observations.

Is there any software out there that can interpret those files?
I can look at the XML in raw and sift throught the garbage, but I was curious
as to what else can be done with those two files.
Could I use this and somehow get it automatically from WU and then
display it on my website?

Any advice? Tips? Tricks?

Best Regards

Joerg

Acurite Pro Weather Center with 5-in-1 Sensor Array ca 35' above ground and 10' above roof line.

WU Station ID KWIWATER29


Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: WU's XML Download
« Reply #1 on: June 03, 2017, 11:30:43 AM »
Hi,
yes you can use these to show data on your website or as I did in my template even load all the history.
They are available in various groupings - daily, monthly etc.

I am not sure if there is any SW which can load data from WU (usually it is the other way around, they send data to WU), but you can use PHP scripts to parse the XML and then do whatever you want with it - display it directly, save to database etc.

This could also help:
https://www.w3schools.com/php/php_xml_simplexml_read.asp

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7549
    • Eagle Bay Weather
Re: WU's XML Download
« Reply #2 on: June 03, 2017, 12:01:12 PM »
A lot of options...  what exactly do you want to do?  You could use BeautifulSoup in Python for instance.  Or JS scrape.  Or JSON interpretation.

Or this....  https://github.com/initialstate/wunderground-sensehat/wiki/Part-1.-How-to-Use-the-Wunderground-API
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline Flying_German

  • Red sky in morning, pilot's warning.
  • Member
  • *
  • Posts: 20
Re: WU's XML Download
« Reply #3 on: June 03, 2017, 02:31:20 PM »
Thanks.

That gives me some ideas for now.

As for what I want to do, I was thinking of being able to display the data from the XML
on my website at some point.
But I'd like to automate the process instead of me having download and insert the new XML
every now and so often.
Best Regards

Joerg

Acurite Pro Weather Center with 5-in-1 Sensor Array ca 35' above ground and 10' above roof line.

WU Station ID KWIWATER29


Offline Bushman

  • Forecaster
  • *****
  • Posts: 7549
    • Eagle Bay Weather
Re: WU's XML Download
« Reply #4 on: June 03, 2017, 03:30:23 PM »
Just use a CHRON job
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 5519
    • KomokaWeather
Re: WU's XML Download
« Reply #5 on: June 03, 2017, 04:38:20 PM »
I use the xml to show this on my webpage:
Quote
Current conditions from Weather Underground XML source IONTARIO226
The weather in Komoka, ON Canada Last Updated on June 3, 4:27 PM EDT is
Clear and the temperature 75.6 F (24.2 C) with average wind at 0 kph from the North and gusts of 14.5 kph. 
The temperature feels like 75.6 F (24.2 C). 
The visibility is 24.1 km. and precipitation today is 0.00 in (0 mm) mm.


Enjoy,
Paul

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: WU's XML Download
« Reply #6 on: June 03, 2017, 06:51:35 PM »
Just use a CHRON job

But why would he need a cron job? If I understand it correctly he just wants current data on his webpage in which case it could simply be loaded when a visitor comes to his page. If he doesnt need regularly saving the data you dont need a CRON job. You load it when a user visits the page and set some caching

Offline Flying_German

  • Red sky in morning, pilot's warning.
  • Member
  • *
  • Posts: 20
Re: WU's XML Download
« Reply #7 on: June 04, 2017, 03:33:27 PM »
Just use a CHRON job

But why would he need a cron job? If I understand it correctly he just wants current data on his webpage in which case it could simply be loaded when a visitor comes to his page. If he doesnt need regularly saving the data you dont need a CRON job. You load it when a user visits the page and set some caching

Correct. Only for display, not for storing the data.
Best Regards

Joerg

Acurite Pro Weather Center with 5-in-1 Sensor Array ca 35' above ground and 10' above roof line.

WU Station ID KWIWATER29