|
|
Experimental Physics and
| ||||||||||||||
|
|
I am using currently the php module to display value on a web browser. The program reads first the content of a file to get the whole list of process variables and afterwards performs a ca_get for each of them to know their value. Times to times, the browser tries to download the page with all the values, but does not succeed and I have got a message saying "the document contains no data" although some data should be available. The listing of the php script is the following : <html> <body> <meta http-equiv="refresh" content="60" /> <?php #interface with Epics Iocs to know the values # of variables stored in the data file associated to the unit #load external module dl("php_epics.so"); $unitName = $_GET["unit"];
$fileName = $_GET["fileName"];
echo "<h1>VALUES OF ".$unitName."</h1>";#file parsing to get the variable names list include 'GetList.php'; $variableIdent = array("record","sensor","ai","bi"); $variableList = GetList($fileName,$variableIdent); $nbVar = count($variableList); for ($index=0; $index < $nbVar; $index++) { $variableName = $variableList[$index]; $variableValue = ca_get($variableName); echo "$variableName $variableValue <BR>"; } ?> </body> </html> And the GetList function is the following one :
<?php
#file parsing to get the variable names list stored in fileName
function GetList($fileName,$variableIdent) {
$file=fopen($fileName,"r");
#$variableNumber = 0;
$variableList = "";
$index = 0;
while(! feof($file))
{
$line = fgets($file);
$variableName = strstr($line,$variableIdent[0]);
if ($variableName != FALSE &&
(strstr($line,$variableIdent[1]) != FALSE ||
strstr($line,$variableIdent[2]) != FALSE ||
strstr($line,$variableIdent[3]) != FALSE ))
{
$rawName = strstr($line,"\"");
$variableName = strtok($rawName, "\"");
$variableList[$index] = $variableName;
$index++;
}
}
fclose($file);
return $variableList;
}
?>Has Anyone ever met such a problem ? Thanks Christophe
| ||||||||||||||
| ANJ, 02 Sep 2010 |
·
Home
·
News
·
About
·
Talk
·
Base
·
Modules
·
Extensions
·
· Distributions · Download · Documents · Links · Licensing · |