cURL / Mailing Lists / curl-library / Single Mail

curl-library

Can i access response of HTTP POST other than callback mechanism?

From: Satish Mittal <satish.mittal_at_gmail.com>
Date: Mon, 29 Aug 2005 19:38:53 +0530

Hi All!

I am a newbie to libcurl (in case my query is a trivial one).

My question is that in order to POST data in an HTTP request, we have two
mechanisms: one through CURLOPT_READFUNCTION and the other through
CURLOPT_POSTFIELDS.
I see it as: we should go for callback if we don't have the entire input
data before-hand, instead it's some scenario where i am streaming data.
Whereas if we have the entire buffer in memory, we can use 2nd way of
POSTFIELDS.

In the same way, can i access the entire response ONLY through the
CURLOPT_WRITEFUNCTION
callback? My requirement is to write the POST response in a buffer in
memory( whose maximum size may be fixed also, if user gives an input). Is
there a libcurl API available, which can fill the response in my buffer in
one shot, or which gives me the pointer to response data which i can then
copy in my own buffer.

I looked in the dosumentation but couldn't find such a thing.

Thanks!
Satish
Received on 2005-08-29