My C++ program currently invokes curl through a pipe (popen(\"curl ...\")) to POST a file of JSON data to a web server. This has obvious performance limitations due
What about the required Content-Type header to match application/json just like the op is asking?
Using the CURLOPT_POSTFIELDS from two answers above as well as CURLOPT_POST, the Content-Type automatically gets set to application/x-www-form-urlencoded.
The only way for me to get the headers set correctly was to add what is outlined in this answer: JSON requests in C using libcurl