cURL / Mailing Lists / curl-library / Single Mail


Re: CURLOPT_WRITEDATA required in HTTP post?

From: Daniel Stenberg <>
Date: Fri, 28 Nov 2008 17:23:02 +0100 (CET)

On Fri, 28 Nov 2008, John Wood wrote:

> 1. Do you explicitely need to set either/both CURLOPT_WRITEFUNCTION and
> CURLOPT_WRITEDATA when using HTTP POST? I hadn't set them because I wasn't
> interested in the response from the server (beyond whether it returned HTTP
> 200)

No you don't. But I'd still say that in most cases that's the clever thing to
do since the default is to write the received data to stdout.

> 2. If you do need to set them, why does it work most of the time? In my
> example, were the responses getting dumped to an internal file/buffer which
> was getting full or something?

I can't tell why your case failed at times, I've not seen it happen myself.
The default CURLOPT_WRITEFUNCTION action is fwrite() and the CURLOPT_WRITEDATA
for that is stdout. If that fails, there's something in your system that makes
fwrite() to stdout fail.

Received on 2008-11-28