Newsgroup: it.comp.www.php
Titolo: Riproviamo php

Ciao
questa volta cercherň di essere piů dettagliato
Ho un sistema Linux Fedora core 3 con Apache 2 (httpd-2.0.52-.1) e php4
(php-4.3.10-3.2)
Nella stessa macchina in directory /usr/local/bin/ ho installato un
programma di nome fetch2300 (acquisisce i dati da una stazione meteo)
Ora il problema e il seguente nella pagina
http://127.0.0.1/weatherstation.php
 mi vengono visualizzati solo questi
errori
Notice: Undefined offset: 1 in /var/www/html/weatherstation.php on line 14
Notice: Undefined index: Forecast in /var/www/html/weatherstation.php on
line 17
Notice: Undefined index: Tendency in /var/www/html/weatherstation.php on
line 18
Notice: Undefined index: Time in /var/www/html/weatherstation.php on line 44
Notice: Undefined index: Date in /var/www/html/weatherstation.php on line 44
non ho idea di cosa significhi e chiaramente i dati della stazione non
vengono visualizzati
Allego anche il codice della pagina (se magari qualche anima pia volesse
aiutarmi...)
<?
/* weatherstation.php  - part of the open2300 package
 *
 * Version 1.3
 *
 * Control WS2300 weather station
 *
 * Copyright 2003,2004, Kenneth Lavrsen
 * This program is published under the GNU Public license
 */
exec("/usr/local/bin/fetch2300",$fetcharray);
foreach ($fetcharray as $value)
{
 list($parameter,$parvalue)=explode(" ", $value);
 $ws["$parameter"]=$parvalue;
}
$forecastpic= strtolower($ws["Forecast"]) . ".jpg";
$tendencypic= strtolower($ws["Tendency"]) . ".png";
?>
<html>
<head>
<title>Kenneth's Weather Station, Glostrup, Denmark</title>
<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Refresh" CONTENT="60">
</head>
<body bgcolor="honeydew" text="black" link="blue" vlink="purple"
alink="red">
<h1 align="center">Kenneth's Weather Station, Glostrup, Denmark</h1>
<table border="3" width="700" align="center" bgcolor="ivory">
  <tr>
    <td width="100%">
      <table border="0" cellpadding="0" cellspacing="0" width=100%">
        <tr>
            <td width="55%" valign="top">
                <table border="1" width="100%">
                    <tr>
                        <td width="50%" height="170" valign="top">
<center><b><?=$ws["Time"]?>&nbsp;&nbsp;<?=$ws["Date"]?></b></center><br>
                            <img src="<?=$forecastpic?>" align="left">
                            <br>Forecast: <?=$ws["Forecast"]?><br><br>
                            Tendency: <?=$ws["Tendency"]?> <img
src="<?=$tendencypic?>" align="middle">
                        </td>
                         </td>
                        <td width="50%" height="170" valign="top">
                            Relative Pressure
                            <p align="center"><font
size="5"><?=number_format($ws["RP"],1,'.','')?> hPa</font></p>
                            <p><font size="2">Minimum:
<?=number_format($ws["RPmin"],1,'.','')?> hPa</font><br>
                               <font size="2"><center><?=$ws["TRPmin"]?>
<?=$ws["DRPmin"]?></center></font>
                            <p><font size="2">Maximum:
<?=number_format($ws["RPmax"],1,'.','')?> hPa</font><br>
                               <font size="2"><center><?=$ws["TRPmax"]?>
<?=$ws["DRPmax"]?></center></font>
                        </td>
                    <tr>
                </table>
                <table border="1" width="100%">
                    <tr>
                        <td width="50%" height="170" valign="top">
                            <p>Wind Speed</p>
                            <p align="center"><font size="5"><?=$ws["WS"]?>
m/s</font></p>
                            <p><font size="2">Minimum: <?=$ws["WSmin"]?>
m/s</font><br>
                               <font size="2"><center><?=$ws["TWSmin"]?>
<?=$ws["DWSmin"]?></center></font>
                            <p><font size="2">Maximum: <?=$ws["WSmax"]?>
m/s</font><br>
                               <font size="2"><center><?=$ws["TWSmax"]?>
<?=$ws["DWSmax"]?></center></font>
                         </td>
                        <td width="50%" height="170" valign="top">
                            <p>Wind Direction</p>
                            <p align="center"><font
size="5"><?=$ws["DIRtext"]?></font><br><font size="5"><?=$ws["DIR0"]?>
&deg</font></p>
                            <p><font size="2">Last 5 directions<br>
                               <center><?=$ws["DIR1"]?> &deg,
<?=$ws["DIR2"]?> &deg, <?=$ws["DIR3"]?> &deg,<br>
                               <?=$ws["DIR4"]?> &deg, <?=$ws["DIR5"]?>
&deg</center></font>
                        </td>
                    <tr>
                </table>
                <table border="1" width="100%">
                    <tr>
                        <td width="33%" height="190" valign="top">
                            <p>Rain Total</p>
                            <p align="center"><font
size="5"><?=number_format($ws["Rtot"],1,'.','')?> mm</font></p>
                            <p><br><font size="2">Since:</font><br>
                                   <font size="2"><center><?=$ws["TRtot"]?>
<?=$ws["DRtot"]?></center></font>
                         </td>
                        <td width="33%" height="190" valign="top">
                            <p>Rain last 24 hours</p>
                            <p align="center"><font
size="5"><?=number_format($ws["R24h"],1,'.','')?> mm</font></p>
                            <p><br><font size="2">Maximum:
<?=number_format($ws["R24hmax"],1,'.','')?> mm</font><br>
                                   <font
size="2"><center><?=$ws["TR24hmax"]?> <?=$ws["DR24hmax"]?></center></font>
                         </td>
                         <td width="33%" height="190" valign="top">
                            <p>Rain last 1 hour</p>
                            <p align="center"><font
size="5"><?=number_format($ws["R1h"],1,'.','')?> mm</font></p>
                            <p><br><font size="2">Maximum:
<?=number_format($ws["R1hmax"],1,'.','')?> mm</font><br>
                                   <font
size="2"><center><?=$ws["TR1hmax"]?> <?=$ws["DR1hmax"]?></center></font>
                        </td>
                    <tr>
                </table>
            </td>
            <td width="45%" valign="top">
                <table border="1" width="100%">
                    <tr>
                        <td width="50%" height="170" valign="top">
                            <p>Temperature, Indoor</p>
                            <p align="center"><font size="5"><?=$ws["Ti"]?>
&deg;C</font></p>
                            <p><font size="2">Minimum: <?=$ws["Timin"]?>
&deg;C</font><br>
                               <font size="2"><center><?=$ws["TTimin"]?>
<?=$ws["DTimin"]?></center></font>
                            <p><font size="2">Maximum: <?=$ws["Timax"]?>
&deg;C</font><br>
                               <font size="2"><center><?=$ws["TTimax"]?>
<?=$ws["DTimax"]?></center></font>
                         </td>
                        <td width="50%" height="170" valign="top">
                            <p>Temperature, Outdoor</p>
                            <p align="center"><font size="5"><?=$ws["To"]?>
&deg;C</font></p>
                            <p><font size="2">Minimum: <?=$ws["Tomin"]?>
&deg;C</font><br>
                               <font size="2"><center><?=$ws["TTomin"]?>
<?=$ws["DTomin"]?></center></font>
                            <p><font size="2">Maximum: <?=$ws["Tomax"]?>
&deg;C</font><br>
                               <font size="2"><center><?=$ws["TTomax"]?>
<?=$ws["DTomax"]?></center></font>
                        </td>
                    <tr>
                </table>
                <table border="1" width="100%">
                    <tr>
                        <td width="50%" height="170" valign="top">
                            <p>Dewpoint</p>
                            <p align="center"><font size="5"><?=$ws["DP"]?>
&deg;C</font></p>
                            <p><font size="2">Minimum: <?=$ws["DPmin"]?>
&deg;C</font><br>
                               <font size="2"><center><?=$ws["TDPmin"]?>
<?=$ws["DDPmin"]?></center></font>
                            <p><font size="2">Maximum: <?=$ws["DPmax"]?>
&deg;C</font><br>
                               <font size="2"><center><?=$ws["TDPmax"]?>
<?=$ws["DDPmax"]?></center></font>
                        </td>
                        <td width="50%" height="170" valign="top">
                            <p>Windchill</p>
                            <p align="center"><font size="5"><?=$ws["WC"]?>
&deg;C</font></p>
                            <p><font size="2">Minimum: <?=$ws["WCmin"]?>
&deg;C</font><br>
                               <font size="2"><center><?=$ws["TWCmin"]?>
<?=$ws["DWCmin"]?></center></font>
                            <p><font size="2">Maximum: <?=$ws["WCmax"]?>
&deg;C</font><br>
                               <font size="2"><center><?=$ws["TWCmax"]?>
<?=$ws["DWCmax"]?></center></font>
                          </td>
                    <tr>
                </table>
                <table border="1" width="100%">
                    <tr>
                        <td width="50%" height="190" valign="top">
                            <p>Relative Humidity, Indoor</p>
                            <p align="center"><font size="5"><?=$ws["RHi"]?>
%</font></p>
                            <p><font size="2">Minimum: <?=$ws["RHimin"]?>
%</font><br>
                               <font size="2"><center><?=$ws["TRHimin"]?>
<?=$ws["DRHimin"]?></center></font>
                            <p><font size="2">Maximum: <?=$ws["RHimax"]?>
%</font><br>
                               <font size="2"><center><?=$ws["TRHimax"]?>
<?=$ws["DRHimax"]?></center></font>
                         </td>
                        <td width="50%" height="190" valign="top">
                            <p>Relative Humidity, Outdoor</p>
                            <p align="center"><font size="5"><?=$ws["RHo"]?>
%</font></p>
                            <p><font size="2">Minimum: <?=$ws["RHomin"]?>
%</font><br>
                               <font size="2"><center><?=$ws["TRHomin"]?>
<?=$ws["DRHomin"]?></center></font>
                            <p><font size="2">Maximum: <?=$ws["RHomax"]?>
%</font><br>
                               <font size="2"><center><?=$ws["TRHomax"]?>
<?=$ws["DRHomax"]?></center></font>
                        </td>
                    <tr>
                </table>
            </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<p align="center">Weather Data are loaded directly from Weather Station
which gives a 5-30 seconds delay</p>
<p>
<p align="center"><a href="index.htm">[Weather Index]</a> <a
href="weathergraphs.php">[Weather Graphs]</a>
<a href="phpweather/index.php?icao=EKCH&language=en">[World Weather]</a> <a
href="/">[Kenneth's Homepage]</a></p>
</body>
</html>
Grazie
Daniele


Non ti offendere ma deve essere molto pia !
Non puoi pretendere che uno si legga una listato cosě grande devi
circoscrivere l'errore
capire cosa č e poi eventualmente (se non l'hai ancora risolto ) postare ...
E' solo una questione di buon senso...
Ciao Buon Lavoro

 capire cosa è e poi eventualmente (se non l'hai ancora risolto ) postare


 Daniele
non sono errori sono notice 
inserisci dopo il tag di apertura php (sostituisci anche <? con <?php)
la riga
error_reporting(E_ALL^E_NOTICE);
e leggi..
http://it.php.net/error_reporting
-- 
www.iuz-lab.info

 wrote:
Apparentemente il programma fetch2300 non da' l'output giusto.
Cosa ottieni con:
<?
	$output	= shell_exec('/usr/local/bin/fetch2300');
	print <<<HERE
<pre>
$output
</pre>
HERE;
?>
In teoria dovresti avere un giro tipo
Nome valore
Nome valore
...
Frequency valore
Forecast valore
...
ma mi sa che non e' questo quel che ottieni. Sei sicuro che il file
fetch2300 giri, da linea di comando? Permessi OK, librerie buone?
Leonardo
-- 
Avere studiato senza mettere in pratica e' inutile;
mettere in pratica senza avere studiato e' pericoloso.
                                                - Conphpucio

 ha scritto nel messaggio
news:akk931tag96eb1et5...@L.Serni...
