Collège Alphonse Karr
Club création

test

{source}
<?php
date_default_timezone_set(‘Europe/Paris’);
$heure=date(« H »);
$minute=date(« i »);

$parametres = simplexml_load_file(‘http://www.weatherlink.com/xml.php?user=alphonsekarr&pass=meteo’);

$dewpoint_c = $parametres->dewpoint_c;
$dewpoint_f = $parametres->dewpoint_f;
$dewpoint_string = $parametres->dewpoint_string;
$heat_index_c = $parametres->heat_index_c;
$heat_index_f = $parametres->heat_index_f;
$heat_index_string = $parametres->heat_index_string;
$latitude = $parametres->latitude;
$location = $parametres->location;
$longitude = $parametres->longitude;
$observation_time = $parametres->observation_time;
$observation_time_rfc822 = $parametres->observation_time_rfc822;
$pressure_in = $parametres->pressure_in;
$pressure_mb = $parametres->pressure_mb;
$pressure_string = $parametres->pressure_string;
$relative_humidity = $parametres->relative_humidity;
$station_id = $parametres->station_id;
$temp_c = $parametres->temp_c;
$temp_f = $parametres->temp_f;
$temperature_string = $parametres->temperature_string;
$wind_degrees = $parametres->wind_degrees;
$wind_dir = $parametres->wind_dir;
$wind_kt = $parametres->wind_kt;
$wind_mph = $parametres->wind_mph;
$windchill_c = $parametres->windchill_c;
$windchill_f = $parametres->windchill_f;
$windchill_string = $parametres->windchill_string;

$observation_age = $parametres->davis_current_observation->observation_age;
$dewpoint_day_high_f = $parametres->davis_current_observation->dewpoint_day_high_f;
$dewpoint_day_high_time = $parametres->davis_current_observation->dewpoint_day_high_time;
$dewpoint_day_low_f = $parametres->davis_current_observation->dewpoint_day_low_f;
$dewpoint_day_low_time = $parametres->davis_current_observation->dewpoint_day_low_time;
$dewpoint_month_high_f = $parametres->davis_current_observation->dewpoint_month_high_f;
$dewpoint_month_low_f = $parametres->davis_current_observation->dewpoint_month_low_f;
$dewpoint_year_high_f = $parametres->davis_current_observation->dewpoint_year_high_f;
$dewpoint_year_low_f = $parametres->davis_current_observation->dewpoint_year_low_f;
$et_day = $parametres->davis_current_observation->et_day;
$et_month = $parametres->davis_current_observation->et_month;
$et_year = $parametres->davis_current_observation->et_year;
$heat_index_day_high_f = $parametres->davis_current_observation->heat_index_day_high_f;
$heat_index_day_high_time = $parametres->davis_current_observation->heat_index_day_high_time;
$heat_index_month_high_f = $parametres->davis_current_observation->heat_index_month_high_f;
$heat_index_year_high_f = $parametres->davis_current_observation->heat_index_year_high_f;
$pressure_day_high_in = $parametres->davis_current_observation->pressure_day_high_in;
$pressure_day_high_time = $parametres->davis_current_observation->pressure_day_high_time;
$pressure_day_low_in = $parametres->davis_current_observation->pressure_day_low_in;
$pressure_day_low_time = $parametres->davis_current_observation->pressure_day_low_time;
$pressure_month_high_in = $parametres->davis_current_observation->pressure_month_high_in;
$pressure_month_low_in = $parametres->davis_current_observation->pressure_month_low_in;
$pressure_tendency_string = $parametres->davis_current_observation->pressure_tendency_string;
$pressure_year_high_in = $parametres->davis_current_observation->pressure_year_high_in;
$pressure_year_low_in = $parametres->davis_current_observation->pressure_year_low_in;
$rain_day_in = $parametres->davis_current_observation->rain_day_in;
$rain_month_in = $parametres->davis_current_observation->rain_month_in;
$rain_rate_day_high_in_per_hr = $parametres->davis_current_observation->rain_rate_day_high_in_per_hr;
$rain_rate_hour_high_in_per_hr = $parametres->davis_current_observation->rain_rate_hour_high_in_per_hr;
$rain_rate_in_per_hr = $parametres->davis_current_observation->rain_rate_in_per_hr;
$rain_rate_month_high_in_per_hr = $parametres->davis_current_observation->rain_rate_month_high_in_per_hr;
$rain_rate_year_high_in_per_hr = $parametres->davis_current_observation->rain_rate_year_high_in_per_hr;
$rain_storm_in = $parametres->davis_current_observation->rain_storm_in;
$rain_year_in = $parametres->davis_current_observation->rain_year_in;
$relative_humidity_day_high = $parametres->davis_current_observation->relative_humidity_day_high;
$relative_humidity_day_high_time = $parametres->davis_current_observation->relative_humidity_day_high_time;
$relative_humidity_day_low = $parametres->davis_current_observation->relative_humidity_day_low;
$relative_humidity_day_low_time = $parametres->davis_current_observation->relative_humidity_day_low_time;
$relative_humidity_in = $parametres->davis_current_observation->relative_humidity_in;
$relative_humidity_in_day_high = $parametres->davis_current_observation->relative_humidity_in_day_high;
$relative_humidity_in_day_high_time = $parametres->davis_current_observation->relative_humidity_in_day_high_time;
$relative_humidity_in_day_low = $parametres->davis_current_observation->relative_humidity_in_day_low;
$relative_humidity_in_day_low_time = $parametres->davis_current_observation->relative_humidity_in_day_low_time;
$relative_humidity_in_month_high = $parametres->davis_current_observation->relative_humidity_in_month_high;
$relative_humidity_in_month_low = $parametres->davis_current_observation->relative_humidity_in_month_low;
$relative_humidity_in_year_high = $parametres->davis_current_observation->relative_humidity_in_year_high;
$relative_humidity_in_year_low = $parametres->davis_current_observation->relative_humidity_in_year_low;
$relative_humidity_month_high = $parametres->davis_current_observation->relative_humidity_month_high;
$solar_radiation = $parametres->davis_current_observation->solar_radiation;
$solar_radiation_day_high = $parametres->davis_current_observation->solar_radiation_day_high;
$solar_radiation_day_high_time = $parametres->davis_current_observation->solar_radiation_day_high_time;
$solar_radiation_month_high = $parametres->davis_current_observation->solar_radiation_month_high;
$solar_radiation_year_high = $parametres->davis_current_observation->solar_radiation_year_high;
$station_name = $parametres->davis_current_observation->station_name;
$sunrise = $parametres->davis_current_observation->sunrise;
$sunset = $parametres->davis_current_observation->sunset;
$temp_day_high_f = $parametres->davis_current_observation->temp_day_high_f;
$temp_day_high_time = $parametres->davis_current_observation->temp_day_high_time;
$temp_day_low_f = $parametres->davis_current_observation->temp_day_low_f;
$temp_day_low_time = $parametres->davis_current_observation->temp_day_low_time;
$temp_in_day_high_f = $parametres->davis_current_observation->temp_in_day_high_f;
$temp_in_day_high_time = $parametres->davis_current_observation->temp_in_day_high_time;
$temp_in_day_low_f = $parametres->davis_current_observation->emp_in_day_low_f;
$temp_in_day_low_time = $parametres->davis_current_observation->temp_in_day_low_time;
$temp_in_f = $parametres->davis_current_observation->temp_in_f;
$temp_in_month_high_f = $parametres->davis_current_observation->temp_in_month_high_f;
$temp_in_month_low_f = $parametres->davis_current_observation->temp_in_month_low_f;
$temp_in_year_high_f = $parametres->davis_current_observation->temp_in_year_high_f;
$temp_in_year_low_f = $parametres->davis_current_observation->temp_in_year_low_f;
$temp_month_high_f = $parametres->davis_current_observation->temp_month_high_f;
$temp_month_low_f = $parametres->davis_current_observation->temp_month_low_f;
$temp_year_high_f = $parametres->davis_current_observation->temp_year_high_f;
$temp_year_low_f = $parametres->davis_current_observation->temp_year_low_f;
$thsw_index_day_high_f = $parametres->davis_current_observation->thsw_index_day_high_f;
$thsw_index_day_high_time = $parametres->davis_current_observation->thsw_index_day_high_time;
$thsw_index_month_high_f = $parametres->davis_current_observation->thsw_index_month_high_f;
$thsw_index_year_high_f = $parametres->davis_current_observation->thsw_index_year_high_f;
$uv_index = $parametres->davis_current_observation->uv_index;
$uv_index_day_high = $parametres->davis_current_observation->uv_index_day_high;
$uv_index_day_high_time = $parametres->davis_current_observation->uv_index_day_high_time;
$uv_index_month_high = $parametres->davis_current_observation->uv_index_month_high;
$uv_index_year_high = $parametres->davis_current_observation->uv_index_year_high;
$wind_day_high_mph = $parametres->davis_current_observation->wind_day_high_mph;
$wind_day_high_time = $parametres->davis_current_observation->wind_day_high_time;
$wind_month_high_mph = $parametres->davis_current_observation->wind_month_high_mph;
$wind_ten_min_avg_mph = $parametres->davis_current_observation->wind_ten_min_avg_mph;
$wind_year_high_mph = $parametres->davis_current_observation->wind_year_high_mph;
$windchill_day_low_f = $parametres->davis_current_observation->windchill_day_low_f;
$windchill_day_low_time = $parametres->davis_current_observation->windchill_day_low_time;
$windchill_month_low_f = $parametres->davis_current_observation->windchill_month_low_f;
$windchill_year_low_f = $parametres->davis_current_observation->windchill_year_low_f;

// Calculs
$rain_day = $rain_day_in*25.4;
$wind_kmh = $wind_mph*1.60934;
$wind_kmh_round = number_format($wind_kmh,2);

$temp_day_high_calc1 = $temp_day_high_f-32;
$temp_day_high_not_round = $temp_day_high_calc1*0.55555555555;
$temp_day_high = number_format($temp_day_high_not_round,1);

$temp_day_low_calc1 = $temp_day_low_f-32;
$temp_day_low_not_round = $temp_day_low_calc1*0.55555555555;
$temp_day_low = number_format($temp_day_low_not_round,1);

$wind_day_high = $wind_day_high_mph*1.60934;

$wind_day_high = number_format($wind_day_high,2);

$pressure_day_high = $pressure_day_high_in*33.8639;

$pressure_day_low = $pressure_day_low_in*33.8639;

// remplace la direction du vent en anglais par du français
//if ($wind_dir = Northwest) {
//$wind_dir = str_replace(Northwest, nord-ouest, $wind_dir);
//} elseif ($wind_dir = North) {
// $wind_dir = str_replace(North, nord, $wind_dir);
//} elseif($wind_dir = West) {
// $wind_dir_french = str_replace(West, ouest, $wind_dir);
//} else {
// $wind_dir = wind_dir;
//}
// fin de la traduction

//rafraîchir la page toutes les 3 secondes

header("refresh: 30;");

?>

<table align= »center » width= »80% »>
<tr><td width= »70px »>&nbsp;</td><td><?php echo « Il y a $observation_age seconde(s) »; ?> </td><td>Max du jour</td><td>Min du jour</td></tr>
<tr><td><img src= »images/temp.png » alt= » » /></td><td><?php echo « $temp_c °C » ; ?></td><td><?php echo « $temp_day_high °C à $temp_day_high_time » ; ?></td><td><?php echo « $temp_day_low °C à $temp_day_low_time » ; ?> </td></tr>

<tr><td><img src= »images/pressure.png » alt= » » /></td><td><?php echo « $pressure_mb hPa » ; ?></td><td><?php echo « $pressure_day_high hPa à $pressure_day_high_time » ; ?></td></tr>

<tr><td><img src= »images/moist.png » alt= » » /></td><td><?php echo « $relative_humidity % d’humidité » ; ?></td></tr>

<tr><td><img src= »images/wind.png » alt= » » /></td><td><?php echo « $wind_kmh_round kmh » ; ?></td><td><?php echo « $wind_day_high km/h à $wind_day_high_time » ; ?> </td></tr>


<tr><td>
<img src= »images/rain.png » alt= » » /></td><td><?php echo « $rain_day mm aujourd’hui » ; ?></td></tr>


<tr><td>
UV : </td><td><?php echo « $uv_index » ; ?></td></tr>
</table>

{/source}

 

Guillaume Lambert

Professeur de SVT au collège Alphonse Karr. Webmaster du site.