Re: data
Brought to you by:
iridium
From: Martin G. <gim...@gi...> - 2002-07-14 23:19:20
|
"Adam Fitch" <ad...@da...> writes: > I got PHP Weather running very quickly without any problem. But I have > no idea how to access the information as variables. Here's what the > documentation provided. > <? > $metar = get_metar('KIND'); // Indianapolis, IN - my home > $data = process_metar($metar); > $temp = $data['temp_f']; > ?> Does the above code work? If so, then it's very strange if you say that the $data array is empty... > so I attempted to loop through the $data array and echo out the values, > surprisingly no values came out what-so-ever. Did you use print_r() on $data? > using the pretty function, that returned absolutely nothing as well. > I read through the .inc files hoping to find something there. And I > can do it, but it would probably take me a full day of staring at it > to acquire the list that I'm looking for. You're looking for the lines that store values in the $decoded_metar array. > What I would like to have > is: > temp in farenheit Entry 'temp_f', > temp in celsius Entry 'temp_c', > clouds - (party cloudy, clear skies, etc.) That's a bit tricky as there can be several cloud-layers (up to three). But look for 'cloud_layer1_coverage' or 'cloud_layer1_condition' for the first layer. > visibility (in km and miles) Entries 'visibility_miles' and 'visibility_km', > etc, etc, etc, the more info I could have the better. > > I spent several hours trying to find documentation to tell me this. Yes, there isn't any documentation for this (except the source :-). You should also take a look at the code found in CVS: Individual files with diffs etc: http://cvs.sf.net/cgi-bin/viewcvs.cgi/phpweather/phpweather/ Snapshots: http://phpweather.sourceforge.net/downloads/ That code requires PHP version 4 and uses objects, but the decoding works much like the code you've seen. The advantage is that the array is documented, see this message: http://sourceforge.net/mailarchive/message.php?msg_id=1747747 -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather => Shows the current weather on your webpage and PHP Shell => A telnet-connection (almost :-) in a PHP page. |