hi, 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 <dan...@haxx.se> 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. > > -- > > / daniel.haxx.se | Get the best commercial curl support there is - from me > | Private help, bug fixes, support, ports, new features > | https://www.wolfssl.com/contact/ ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html