Ok d'acc pour l'anémometrie.
Sinon j'ai refais la page stats pour que tout soit executé en local, ca marche super, plus besoin de proxy dans mon cas...
La fonction readfile() en php fait très bien le boulot.
Il y a un deuxième script "graphs.php" à ajouter dans le même répertoire que MyGW.php. Le voici :
Code :
<?php
// Make GraphWeather request
$location="http://".$_GET['domain'].":".$_GET['port']."/graphs?";
$location.="format=".$_GET['format'];
$location.="&starttime=".$_GET['starttime'];
$location.="&stoptime=".$_GET['stoptime'];
$location.="&stylesheet=".$_GET['stylesheet'];
// Switch between jpg and png to send correct header
switch($_GET['format'])
{
case "jpg": default:
header("Content-type: image/jpeg");
break;
case "png":
header("Content-type: image/png");
break;
}
// Send result to standard output
readfile($location);
?>
Voila le MyGW.php un peu corrigé (gmmktime ne donnait pas le bon timestamp, tu m'en avais parlé..., les dernieres 24h affichaient le jour en cours). Il y a juste à régler $domain et $port.
Code :
<?php
$domain='192.168.1.11';
$port='81';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="author" content="GraphWeather" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>Statistiques</title>
<style type="text/css">
body{font-size:80%;margin:0px;padding:0px;background-color:#FFFFFF;color:#555555;text-align:center;}
#frame {width:750px; margin:5px; padding:8px; border:dashed 1px #cccccc; background:#ffd; margin-left:auto; margin-right:auto; text-align: left;}
table {width:100%;}
td {border:solid 1px #cccccc;background:#ffd; text-align:center;}
.item {background:#ffc;}
.title_frame {border:solid 1px #cccccc;background:#ffa;text-align:center;}
.title {font-size:130%;}
.subtitle {font-size:115%; background:#ffa;}
.date{font-style:italic;}
</style>
</head>
<body>
<div id="frame">
<div class="title_frame">
<br/>
<div class="title">Météo - Bois d'Ennebourg (76) - FRANCE</div>
<div class="date">généré dynamiquement avec la version 1.5 de GraphWeather</div>
<br/>
</div>
<br />
<table>
<tr>
<td colspan='5' class="subtitle">Périodes</td>
</tr>
<tr>
<td class="item"><a href="MyGW.php?page=graphs_day">Graphique des dernières 24h</a></td>
<td class="item"><a href="MyGW.php?page=graphs_month">Graphique du mois</a></td>
<td class="item"><a href="MyGW.php?page=stats_day">Statistiques du jour</a></td>
<td class="item"><a href="MyGW.php?page=stats_month">Statistiques du mois</a></td>
<td class="item"><a href="MyGW.php?page=stats_year">Statistiques de l'année</a></td>
</tr>
</table>
<br/>
<?php
if(!isset($_GET['page'])) $page="stats_year";
else $page=$_GET['page'];
switch($page)
{
case "stats_year":
$time=localtime(time(),TRUE);
$starttime=mktime(0,0,0,1,1,$time['tm_year']);
$stoptime=mktime(0,0,0,1,1,$time['tm_year']+1);
$file=file("http://$domain:$port/stats?format=template&starttime=$starttime&stoptime=$stoptime&template=include_year.inc");
foreach($file as $line) echo $line;
break;
case "stats_month":
$time=localtime(time(),TRUE);
$starttime=mktime(0,0,0,$time['tm_mon']+1,1,$time['tm_year']);
$stoptime=mktime(0,0,0,$time['tm_mon']+2,1,$time['tm_year']);
$file=file("http://$domain:$port/stats?format=template&starttime=$starttime&stoptime=$stoptime&template=include_month.inc");
foreach($file as $line) echo $line;
break;
case "stats_day":
$time=localtime(time(),TRUE);
$starttime=mktime(0,0,0,$time['tm_mon']+1,$time['tm_mday'],$time['tm_year']);
$stoptime=mktime(0,0,0,$time['tm_mon']+1,$time['tm_mday']+1,$time['tm_year']);
$file=file("http://$domain:$port/stats?format=template&starttime=$starttime&stoptime=$stoptime&template=include_day.inc");
foreach($file as $line) echo $line;
break;
case "graphs_day":
$time=time();
$starttime=$time-86400;
$stoptime=$time;
echo "<div style="text-align:center;" >";
echo "<img src="graphs.php?domain=$domain&port=$port&format=jpg&starttime=$starttime&stoptime=$stoptime&stylesheet=little.xml"/>";
echo "</div>";
break;
case "graphs_month":
$time=localtime(time(),TRUE);
$starttime=mktime(0,0,0,$time['tm_mon']+1,1,$time['tm_year']);
$stoptime=mktime(0,0,0,$time['tm_mon']+2,1,$time['tm_year']);
echo "<div style="text-align:center;" >";
echo "<img src="graphs.php?domain=$domain&port=$port&format=jpg&starttime=$starttime&stoptime=$stoptime&stylesheet=little.xml"/>";
echo "</div>";
break;
}
?>
</div>
</body>
</html>
Antoine.