curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.


From: ka sc via curl-library <>
Date: Mon, 28 Oct 2019 20:14:45 +1100

Sorry, I see this has been asked a lot before.
So that means I should read the data into a buffer and pass a pointer like
 const char *dataChar = data.c_str();
 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, dataChar);
If somebody remembers an example out there thanks for saving the google

On Mon, Oct 28, 2019 at 7:54 PM Daniel Stenberg <> wrote:
> On Mon, 28 Oct 2019, ka sc via curl-library wrote:
> > curl -XPOST localhost:4001/db/load -H "Content-type: text/plain"
> > --data-binary @"data/input.dump" --libcurl code.c
> 1. You don't want "-XPOST" when you use -d or a --data* flag. Remove it.
> 2. "--data-binary @"data/input.dump" is reading the file into a buffer and
> uses CURLOPT_POSTFIELDS to send it as a POST.
> > curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1);
> This would make it use the read callback (or stdin) instead to get the data,
> which you of course can opt to do.
> --
> / | Get the best commercial curl support there is - from me
> | Private help, bug fixes, support, ports, new features
> |
Received on 2019-10-28