cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: retrieving complete response using curl_exec()

From: Michael <lists.curl-and-php_at_mas.ml1.net>
Date: Wed, 02 Feb 2005 18:06:24 -0500

On Wed, 2 Feb 2005, Daniel Stenberg said:
> On Wed, 2 Feb 2005, Michael wrote:
>
> > What do I need to do to make sure that curl_exec() returns the
> > entire response and not just a fragment? What am I missing?
>
> It should return the entire response. Anything else is a bug in
> either end.

Well, I'm doing the standard thing of setting CURLOPT_RETURNTRANSFER and
assigning the output of curl_exec to a variable. That's where I'm
getting the problem -- that variable only has part of the response page.

If I turn CURLOPT_RETURNTRANSFER off and just output to the browser, I
get the whole page, BUT if I keep that setting off and use ob_start,
ob_get_contents, and ob_end_clean to get the contents of the output
buffer, I get the same fragment as I do in the first case.

Finally, if I use curl on the command line, I get the whole thing. So it
seems like either there's something I'm not doing right in my program,
or something isn't set up right. Is there some transfer limit setting
somewhere that might be set wrong? The fragments are all about 8270
bytes long, but not always exactly the same.

It also doesn't matter if I set CURL_HTTP_VERSION_1_0 or
CURL_HTTP_VERSION_1_1. Since the first one forces the server not to send
"Transfer-encoding: chunked", I thought that might help, but it doesn't.

What else should I look at? When you say it's a bug on either end, do
you have any suggestions as to how I could figure out where the bug is?

Thanks for your help!

Mike
Received on 2005-02-03