Jump to content

hanwellchris

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hanwellchris's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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
  2. Hi I have implemented a socket in PHP 5.1 which sends a command to a 3rd Party server. The server responds with some XML data. However the data I receive has had all of the XML tags removed, so that I get all of the data items concatenated together. I have used some socket monitors, and I am, absolutely certain that the correct data is being sent buy the server, it is just not being received properly by PHP. I am using fsockopen ( 127.0.0.1 ) and fgets, but I have also tried fread and it makes no difference. I still only ever get the data part of the XML string without the tags. I have searched the web and not found anything similar. Does any one know what I might be doing wrong?? Al the Best Chis
  3. I have an application which is using PHP to talk to a socket on a service implemented in Delphi. The PHP requests data from the delphi service which is monitoring some third party real time data. The command protocol is simple, a command string is passed by PHP to the service, and it returns an XML formatted set of data. I first implemented this a year ago, under PHP 5 and apache 2, and it worked fine, but I have recently setup a new system using exactly the same tools and versions and found that any XML fomatted data that I send across the socket is having its tags removed, resulting in just the data items all concatenated together. I have a service test harness also written in Delphi which is successfully retrieving the entire XML string, so I am confident that it is being sent to the socket OK. It seems that the PHP socket implementation is arbitrarily stripping out the tags. I can see the string as it is received by the PHP and it does not have any tags in it!!! I am using fsocketopen, and fgets (not fgetss) to read the data. I am pulling my hair out with this one, and I dont have much to spare! Does anyone have any ideas?? Thanks Chris
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.