|
From: <php...@li...> - 2010-02-06 18:52:07
|
On Sat, 2010-02-06 at 23:36 +0700, php...@li... wrote: > > Does the remote server respond with HTTP/1.1 by any chance? > > It does. If the data you receive is encoded in HTTP/1.1 chunks, your fgets() is incorrect, too. The HTTP/1.1 chunk data format is: length\r\n data\r\n The last packet is: 000\r\n\r\n I don't think that there's a bug in PHP or the PHP/Java Bridge: Java.inc uses chunked connections too. Please take a look at the class java_ChunkedSocketChannel from Protocol.inc for an example how to receive HTTP/1.1 chunked data. I think the bug is in the line: contents = fgets($fs, 4096); // Chunk download The packet may be longer than 4096 bytes. You must extract the data length from eack packet header. Regards, Jost Bökemeier |