Update: Yahoo! Weather

Since the old Yahoo feeds stopped working, I’ve switched my code to use https://developer.yahoo.com/weather/

Note, contrary to what the documentation says, you don’t  need any API keys or authentication.  You can just make a standard GET request and get JSON data back.

The developer page mentions a rate limit of 2,000 signed calls a day but again there’s no indication if/how this is being enforced.

The format is slightly different.  First you need to construct a YQL query, however this is well documented.

Some example PHP code of my own (using the FuelPHP framework):

// Build query for correct city
$BASE_URL      = "http://query.yahooapis.com/v1/public/yql";
$yql_query     = sprintf('select * from weather.forecast where woeid in (select woeid from geo.places(1) where woeid=%d)',

$yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&format=json";

// Make call with cURL
$session = curl_init($yql_query_url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($session);

if (curl_errno($session)) {
    \Log::error('Yahoo check: '.curl_error($session));

$weather_data = json_decode($json);

if (! property_exists($weather_data, 'query')) {
    return false;

return $weather_data->query->results->channel;

Note, regardless how much data you request, the results are contained inside a JSON channel object, which is inside results, which in turn is within the main query object.

Workaround for broken Yahoo! Weather apps

Update – 27 July 2016 – the alternative URL stopped working in mid-April, however you can get weather data via a simple plain, unsigned YQL GET request. See my example.

As indicated in this Reddit thread as well as numerous blogs this past week, Yahoo! have changed their XML weather feed (which provides get current observations and a forecast for the city of your choice) from an open service that responds to simple HTTP GET requests to a locked-down API using OAuth.

Unfortunately – though entirely predictably, given it’s widespread use – this has broken things all over the place. It doesn’t help that the Yahoo Developer blog hasn’t been updated since July 2013.

Fortunately there’s a quick workaround by changing the URL if you don’t have time (or the skills, or the suitable web-hosting) to setup OAuth.

Old broken URL for London:


New working URL, no OAuth required:  Now doesn’t work either


Caveat: Clearly there’s no guarantee whether [sic] this will continue to work.

Other options: OpenWeatherMap looks promising.

Opinion: A public weather feed shouldn’t require authentication. I mean, it’s the weather. Caching? Yes. Rate limiting? Perhaps. API keys? No (or at least, not a legacy service with a single endpoint.)

Also, if you’re providing a service for free, great, but it’s probably worth also creating a blog or mailing list for announcements and encouraging everyone to sign up to it.

Further light reading (if a little tangential): Adactio on Digital Preservation (2012)