Win32 platform. Console app that fetches the current temperature from a zipcode or city name you put on the command line. I set it up to only output the value, so it looks very boring, but for Cacti/RRD use, it keeps one from needing to do any parsing.
Velvet Jones
Anyone Interested in a City Temperature App ?
Moderators: Developers, Moderators
-
- Posts: 4
- Joined: Tue Apr 16, 2002 1:00 pm
Here is a trivial perl script that I use. Requires Geo::Weather from http://freshmeat.net/projects/geoweather/?topic_id=96. This is weather.com data.
#!/usr/bin/perl
use Geo::Weather;
$zipcode = $ARGV[0];
my $weather = new Geo::Weather;
$weather->{timeout} = 5; # set timeout to 5 seconds instead of the default of 10
my $current = $weather->get_weather($zipcode);
# Temperature, Heat Index, Barometric Pressure, Relative Humidity, Dewpoint
print "$current->{temp} $current->{heat} $current->{baro} $current->{humi} $current->{dewp}";
tim
#!/usr/bin/perl
use Geo::Weather;
$zipcode = $ARGV[0];
my $weather = new Geo::Weather;
$weather->{timeout} = 5; # set timeout to 5 seconds instead of the default of 10
my $current = $weather->get_weather($zipcode);
# Temperature, Heat Index, Barometric Pressure, Relative Humidity, Dewpoint
print "$current->{temp} $current->{heat} $current->{baro} $current->{humi} $current->{dewp}";
tim
Who is online
Users browsing this forum: No registered users and 0 guests