Avec ce bout de code tu peux bien voir comment est structuré le tableau:
<?php
$query = 'Paris';
$json = json_decode(file_get_contents('http://query.yahooapis.com/v1/public/yql?format=json&q=select%20*%20from%20geo.placefinder%20where%20text%3D%22'.$query.'%22'), true);
?>
<pre><?php print_r($json); ?></pre>
Ici pour récupérer le WOEID tu as juste à prendre $json[query][results][Result][woeid], si il y a plusieurs villes du même nom, ça sera $json[query][results][Result][0][woeid] ou [1]... selon la ville que tu choisis.
Et ici un bout de code pour avoir les informations sur trois jours.
<?php
$query = 'Paris';
$json = json_decode(file_get_contents('http://query.yahooapis.com/v1/public/yql?format=json&q=select%20*%20from%20geo.placefinder%20where%20text%3D%22'.$query.'%22'), true);
$weather_feed = file_get_contents('http://weather.yahooapis.com/forecastrss?u=c&w='.$json[query][results][Result][woeid]);
if(!$weather_feed) die('weather failed, check feed URL');
$weather = simplexml_load_string($weather_feed);
$channel_yweather = $weather->channel->children("http://xml.weather.yahoo.com/ns/rss/1.0");
$item_yweather = $weather->channel->item->children("http://xml.weather.yahoo.com/ns/rss/1.0");
foreach($item_yweather as $x => $yw_item) {
foreach($yw_item->attributes() as $k => $attr) {
if($k == 'day') $day = $attr;
if($x == 'forecast') { $yw_forecast$x]$day . '']$k] = $attr; }
else { $yw_forecast$x]$k] = $attr; }
}
}
?>
<pre><?php print_r($yw_forecast); ?></pre>
Juste pour savoir, comment tu fais pour récupérer la localisation de la personne avec son IP.