36 lines
1.4 KiB
PHP
36 lines
1.4 KiB
PHP
|
<?php
|
||
|
require('class/GoogleWeather.class.php');
|
||
|
|
||
|
//ça récupère un truc du style : http://www.google.com/ig/api?weather=paris&hl=fr
|
||
|
if($city != '' || $city != null){
|
||
|
$gweather = new GoogleWeatherAPI($city,'fr');
|
||
|
|
||
|
if($gweather->isFound()) {
|
||
|
$currentTemp = $gweather->getCurrent();
|
||
|
$forecastTemp = $gweather->getForecast();
|
||
|
}
|
||
|
$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) {?>
|
||
|
<link rel="stylesheet" type="text/css" href="css/soleil.css">
|
||
|
<?}
|
||
|
if(strpos(strtolower($present_weather),"nuage") !== false) {?>
|
||
|
<link rel="stylesheet" type="text/css" href="css/nuage.css">
|
||
|
<?}
|
||
|
if(strpos(strtolower($present_weather),"peu nuageux") !== false) {?>
|
||
|
<link rel="stylesheet" type="text/css" href="css/peunuage.css">
|
||
|
<?}
|
||
|
if((strpos(strtolower($present_weather),"pluie") !== false) || (strpos(strtolower($present_weather),"averse") !== false)) {?>
|
||
|
<link rel="stylesheet" type="text/css" href="css/pluie.css">
|
||
|
<?}
|
||
|
if(strpos(strtolower($present_weather),"neige") !== false) {?>
|
||
|
<link rel="stylesheet" type="text/css" href="css/neige.css">
|
||
|
<?}
|
||
|
}else
|
||
|
$present_weather = 'Ville non renseignée';
|
||
|
|