2010-09-15 13:05:52 +02:00
|
|
|
<?php
|
|
|
|
require('class/GoogleWeather.class.php');
|
|
|
|
|
|
|
|
//ça récupère un truc du style : http://www.google.com/ig/api?weather=paris&hl=fr
|
2010-09-17 15:38:57 +02:00
|
|
|
if($ville != '' || $ville != null){
|
|
|
|
$gweather = new GoogleWeatherAPI($ville,'fr');
|
2010-09-15 13:05:52 +02:00
|
|
|
|
|
|
|
if($gweather->isFound()) {
|
2010-09-17 15:38:57 +02:00
|
|
|
$city = $gweather->getCity();
|
2010-09-15 13:05:52 +02:00
|
|
|
$currentTemp = $gweather->getCurrent();
|
|
|
|
$forecastTemp = $gweather->getForecast();
|
2010-09-15 16:55:54 +02:00
|
|
|
|
2010-09-15 13:05:52 +02:00
|
|
|
$present_weather = 'Actuellement : '.$currentTemp['temp_c'].'°C - '.$currentTemp['condition'];
|
|
|
|
$i=0;
|
|
|
|
foreach($forecastTemp as $temp) {
|
|
|
|
${'future_weather'.$i} = $temp['day_of_week'].' : '.$temp['low'].'°C | '.$temp['high'].'°C - '.$temp['condition'];
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(strpos(strtolower($present_weather),"soleil") !== false) {?>
|
2010-09-27 12:48:53 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="modules/weather/css/soleil.css">
|
2010-09-15 13:05:52 +02:00
|
|
|
<?}
|
|
|
|
if(strpos(strtolower($present_weather),"nuage") !== false) {?>
|
2010-09-27 12:48:53 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="modules/weather/css/nuage.css">
|
2010-09-15 13:05:52 +02:00
|
|
|
<?}
|
|
|
|
if(strpos(strtolower($present_weather),"peu nuageux") !== false) {?>
|
2010-09-27 12:48:53 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="modules/weather/css/peunuage.css">
|
2010-09-15 13:05:52 +02:00
|
|
|
<?}
|
|
|
|
if((strpos(strtolower($present_weather),"pluie") !== false) || (strpos(strtolower($present_weather),"averse") !== false)) {?>
|
2010-09-27 12:48:53 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="modules/weather/css/pluie.css">
|
2010-09-15 13:05:52 +02:00
|
|
|
<?}
|
|
|
|
if(strpos(strtolower($present_weather),"neige") !== false) {?>
|
2010-09-27 12:48:53 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="modules/weather/css/neige.css">
|
2010-09-15 13:05:52 +02:00
|
|
|
<?}
|
2010-09-15 16:55:54 +02:00
|
|
|
}else{ $present_weather = 'Ville non trouvé : '.$city; }
|
2010-09-15 13:05:52 +02:00
|
|
|
}else
|
|
|
|
$present_weather = 'Ville non renseignée';
|
|
|
|
|