I have not got to the point of parsing the xml. There is no xml to parse! It first fell over in my xml parsing, and that has let me back to the reception of the data through the socket. I read from the socket with the following function;
function RLogWebServer( $Command, $Parameters )
{
$fp = fsockopen( "127.0.0.1", 3400, $errno, $errstr, 10 );
if ( !$fp )
{
echo "<br />$errstr ( $errno )<br />\n";
$Result = Array();
}
else
{
// Build the command (and parameter list) string
$Out = $Command;
if ( $Parameters != '' )
{
$Out .= ":".$Parameters;
}
$Out .= "\n";
fputs( $fp, $Out, strlen( $Out ) );
fflush( $fp );
$In = '';
while ( !feof( $fp ) )
{
$In .= fgets( $fp, 128 );
}
fclose( $fp );
$Result = explode( "@@", trim($In) );
}
return $Result;
}
I have put print statements at all points in this function and it is clear that the opriginal XML is nopt making it to the fgets function. The $In that I build the result in always contains the data part of the xml string.
If I send;
<Sensor><Name>Sensor1</Name><Type>7</Type><Status>0</Status></Sensor>
down the socket, I receive;
Sensor170
This is madness!!. I can see using socket tools (tcpspy) that I really am sending the full XML type string into the socket, but it just doesn't seem to be coming out the other end. It is as if some kind of filter is acting on the stream that I am not aware of. This same code worked 18months ago when I first tried it. I have just resurrected it for another project, and got stumped at the first hurdle. It seems as if it must be some PHP.INI setting, but I don't know what.
All the Best
Chris