views:

452

answers:

3

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

+1  A: 

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.

alex
+1  A: 

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.

Björn
Thanks! But the Yahoo Weather API. Is it possible to make a search engine for it? I see you need to use a unique WOEID in the URL like this; http://weather.yahooapis.com/forecastrss?w=locatio to get the right location. This works great if all users on my site only have one Weather feed. But is it possible to make a search engine (with PHP) so that the users can costumize the location?
cvack
+1  A: 

look in this answer :

http://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.

Haim Evgi