| Citation : 
 
 <?
setlocale(LC_TIME, "fr_FR" ); // ou "fr"
 
 $partner = "";
 $ville = "FRXX0204"; $vname="Foix";
 $jours = 10;
 $url = "http://xoap.weather.com/weather/local/".$ville."?cc=*&unit=s&dayf=".$jours;
 
 // Conversion Fahrenheit->Celsius
 function f2c($t) { return round(($t-32)*5/9); }
 
 // Lecture d'un fichier XML
 function lit_xml($chaine,$isFile,$item,$champs) {
 // on lit le fichier ou la chaîne
 if($isFile) $chaine = @file_get_contents($chaine);
 if($chaine) {
 // on explode sur <item>
 $tmp = preg_split("/<\/?".$item.">/",$chaine);
 // pour chaque <item>
 for($i=1;$i<sizeof($tmp);$i++)
 // on lit les champs demandés <champ>
 foreach($champs as $champ) {
 $tmp2 = preg_split("/<\/?".$champ.">/",$tmp[$i]);
 // on ajoute au tableau
 $tmp3[$champ][] = trim(@$tmp2[1]);
 }
 // et on retourne le tableau
 return @$tmp3;
 }
 }
 
 // Extraction primaire
 $xml = lit_xml($url,true,"day d=.*",array("hi","low","part p=\"d\"","part p=\"n\"" ));
 
 // Extraction des icones, messages et du taux d'humidité
 for($i=0;$i<$jours;$i++) {
 $tmp = preg_split("/<\/?icon>/",$xml["part p=\"d\""][$i]);
 $xml["icond"][$i] = $tmp[1];
 $tmp = preg_split("/<\/?t>/",$xml["part p=\"d\""][$i]);
 $xml["altd"][$i] = $tmp[1];
 $tmp = preg_split("/<\/?hmid>/",$xml["part p=\"d\""][$i]);
 $xml["hmid"][$i] = $tmp[1];
 $tmp = preg_split("/<\/?icon>/",$xml["part p=\"n\""][$i]);
 $xml["iconn"][$i] = $tmp[1];
 $tmp = preg_split("/<\/?t>/",$xml["part p=\"n\""][$i]);
 $xml["altn"][$i] = $tmp[1];
 }
 
 ?>
 
 <STYLE type="text/css"><!--
 .fond { background-color:#669999 }
 .corps { background-color:#D8E9EC }
 .titre { color: #FFFFFF }
 .sstitre { color: #858586 }
 --></STYLE>
 
 <table class=fond>
 <tr>
 <td class=titre><strong>Prévisions Météo sur
 <?=$vname?>
 </strong></td>
 </tr>
 
 <? for($i=0;$i<$jours;$i++) { ?>
 <tr><td class=corps><table>
 <tr>
 <td colspan=3 class=sstitre><strong>
 <?=ucfirst(strftime("%A %d %B %Y",time()+$i*24*3600))?>
 </strong></td>
 </tr>
 <tr>
 
 <td>Températures Maximale :
 <?=($xml["hi"][$i]=="N/A" )?"N/A":f2c($xml["hi"][$i])."°C"?>
 </td>
 <td class=sstitre>JOUR</td>
 <td class=sstitre>NUIT</td>
 </tr>
 <tr>
 
 <td>Températures Minimale :
 <?=($xml["low"][$i]=="N/A" )?"N/A":f2c($xml["low"][$i])."°C"?>
 </td>
 <td rowspan=2><img src="img/<?=$xml["icond"][$i]?>.png"
 width=40 alt="<?=$xml["altd"][$i]?>"></td>
 
 <td rowspan=2><img src="img/<?=$xml["iconn"][$i]?>.png"
 width=40 alt="<?=$xml["altn"][$i]?>"></td>
 </tr>
 <tr>
 
 <td>Pourcentage d'humidité :
 <?=$xml["hmid"][$i]?>
 </td>
 </tr>
 </table></td></tr>
 <? } ?>
 
 
 </table>
 
 |