开发者

How do I get the average weather for any given zipcode in Perl?

Is there a Perl module to get the avg. temperature for any given zipcode? For instance, Wikipedia has the Avg. high, avg. low & daily mean temperature for Los Angeles.

I'd like to do this开发者_StackOverflow中文版 in Perl somehow but can't find a module to do this (e.g. type in 10001 and get the avg. temp. for New York).


Searching CPAN for "weather" gives you a ton of options including Google Weather, weather.com and Weather Underground.

Most of these are just fetching a URL and parsing the resulting XML or JSON. So if you don't want to use the modules you can do it manually using LWP::Simple and either XML::Simple or JSON::Any to parse the result.


http://www.melissadata.com/lookups/ZipWeather.asp?ZipCode=XXXXX

For New York: http://www.melissadata.com/lookups/ZipWeather.asp?ZipCode=10001

Then curl and parse the result...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜