|Thank you for this otherwise extremely useful class, but I've run into a rather strange problem - the response is truncated at 8K, and I can't seem to read the remainder of the response.|
$c = new http_class;
$c->timeout = 15;
$c->data_timeout = 15;
$c->debug = 0;
$c->file_buffer_length = 1024*1024;
I left out the error checking just to demonstrate the problem.
The response comes back truncated at 8K, even though I've set both the file_buffer_length, and a large size when calling ReadReplyBody().
|2010-12-07 04:22:29 - In reply to message 1 from Junkie Narkosvin|
|The ReadReplyBody second parameter is not the length you want to read but rather the limit of bytes that will be returned.|
You need to keep calling the ReadReplyBody until the body parameter is empty.
|2010-12-07 19:35:53 - In reply to message 2 from Manuel Lemos|
|I guess what's missing for me is some way to read the entire respose - in my case, I'm going to parse the returned HTML document, so reading a partial response really isn't that useful.|
I would suggest adding a method similar to this one:
$buffer = '_';
$body = '';
$error = '';
while ($buffer != '')
$error = $this->ReadReplyBody($buffer, $this->file_buffer_length);
if ($error !='')
$body .= $buffer;
I added this method to my own copy of the script, and it worked as expected.
Hope this contribution is useful :-)
|2010-12-08 07:31:18 - In reply to message 3 from Junkie Narkosvin|
|OK, I may add it in a future release. Thanks for the suggestion.|
|2011-01-27 02:31:34 - In reply to message 3 from Junkie Narkosvin|
|I just uploaded a new version with the function ReadWholeReplyBody that reads the whole reply body at once. Thanks for the suggestion.|