View Full Version : Superfluous lines using fsockopen/fread

07-08-2007, 07:57 PM

I have a page that sends a post request to another page, which generates some data and echos it back to the first page. It works perfectly on my own machine (windows), but when I put it on the live machine (unix), the request page seems to be having superfluous lines being returned.

From my logging records, I know that the data is fine before it is sent back, but after it is received by the request page, there is a line with the number 2000 on it after every 242 lines of the data, each line being 32 bytes long. However the last one of these lines is almost always letters. I'm assuming this is a data length in hex, but it doesn't seem to tie up with the calculated length based on 32 (length of each line) * 242.

I'm using fsockopen/fread or fgets/fclose to send the request and retrieve the data. Both fread and fgets seem to have the same problem.

I've spent several days trying to figure out how to stop this happening, but I've run out of ideas. Has anyone experienced this before and solved it?