This question is no longer up-to-date -- Google shut down the unofficial weather API in 2012
I\'d like to put some weather forecast to a
Encoding problem:
For some reason Google returns the XML content without proper encoding declaration. One would expect something like:
But they skip the encoding attribute in the header. This makes the simplexml_load_file function assume the default encoding of UTF-8. I would consider this a bug in their API implementation, since the XML spec defines UTF-8 as the fallback default encoding.
To compesate for this, try something like:
Which seems to work. The ISO-8859-2 value was a pure guess.
Fahrenheit/Celsius:
I don't see an easy way to request the temperature data to be provided in Celsius instead of Fahrenheit in this API (I couldn't find the official doc, am I blind?). However conversion from F to C shouldn't be hard at all.
Try this formula:
(°F - 32) x 5/9 = °C
which you can find in thousand of places. I took it from http://www.manuelsweb.com/temp.htm