cURL / Mailing Lists / curl-library / Single Mail


RE: How to send SOAP+XML, using the "xml in memory"

From: Patrick Monnerat <>
Date: Tue, 1 Jul 2014 15:53:48 +0200

Ajay Garg wrote:

d-from-and-to-file-using-libcurl-c gives us the solution to sending a
XML, when it ought to be read from a file.

> Is it possible to achieve the same "end result", but wherein the XML
is created "on the fly" during program-run, and not read from a file?

If all data are ready in memory before request, instead of the
CURLOPT_READFUNCTION/CURLOPT_READDATA options you may use or and specify
the length with

If the data generation is done during the transfer, you have to update
the read_data() in the example you mention to return a new bunch of
data. You set the callback address as in the example, and you can use
the user data pointer (CURLOPT_READDATA) to pass a data generation
control block of your own (i.e.: it does not have to be a FILE *: its
real type depends on what you are doing with in the read_data function).

I suggest you read


List admin:
Received on 2014-07-01