开发者

International weather API (PHP) [closed]

开发者 https://www.devze.com 2022-12-24 08:06 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. Yo开发者_开发问答u can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

I'm looking for the best (free/cheap) international weather PHP API out there. Any suggestions?


look in this answer :

https://stackoverflow.com/questions/507441/best-weather-apis

the chosen answer give this :

•The National Weather Service has a SOAP Web service.

•Yahoo has a weather RSS feed.

•Animaonline is a weather API powered by Google. There are code samples and tutorial links on the project page, but I found another tutorial here.


What do you want to do with the data?

If you just want to display it, look for a weather site with an RSS feed. Then you can easily request it, cache it on your server and parse it.

For requesting, use cURL or file_get_contents() (if your php.ini allows it).

For caching, just check filemtime() and make a comparison.

To parse it, use SimpleXML.


Yahoo Weather or Google Weather are both fast and free. I've used Google the most, you can use both city name or latitude/longitude to collect data.

Worth noting is that Google doesn't really provide an API and is undocumented, so no one knows the future of it.


Both weathernation and feedsyndicate.com both offer a commercial api

Weathernation.com isn't very inexpensive.. feedsyndicate can be but you need to ask for a deal.

0

精彩评论

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