free php based weather input

Posted on
Wed Feb 18, 2004 10:59 pm
Guest offline

free php based weather input

This might prove useful to people....

I just came across http://phpweather.sourceforge.net/ which is an open source set of php scripts that will download current weather observations from what seems like an endless set of observation points and decode them into human readable form (the home page defaults to a station that isn't reporting right now, but the sites in the US I used worked fine).

This bit of php code will echo the temperature at National Airport outside of Washington, DC (once installed and setup to use DC as the default, took about 10 minutes):

<?php
require('phpweather.php');
require('pw_utilities.php');

$weather = new phpweather();
$data = $weather->decode_metar();
echo $data['temperature']['temp_f'];
?>

You could call this from applescript via something like:

set dca_temp to do shell script '/usr/local/bin/php /path/to/dca.php'

Obviously this requires a working install of php with the --enable-cli flag turned on, but for those that are willing to set this up it's free and easy.

Other variables like cloud cover, wind chill, wind speed and direction, humidity, etc... are reported as well.

Hope it helps someone,
Ware Adams

Posted on
Thu Feb 19, 2004 9:00 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: free php based weather input

Hello Ware,

Thanks for the great tip. I'm already using PHP on my home server, so I'm going to have to give this a try.

Regards,
Matt

Posted on
Thu Feb 19, 2004 9:33 am
dalenis offline
Posts: 123
Joined: Apr 02, 2003
Location: Lunenburg, MA

(No subject)

I'm using HamWeather on my website Massapoag Pond for the forcast. This is also php based, but it is not free. They charge for keeping the scripts up to date based, on changes that the National Weather makes to their data. I have been using it for a month now and seems to work very well.

Dale

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 19 guests