How do I POST a buffer of JSON using libcurl?
问题 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 to the need to save the JSON to a file and invoke curl in a subshell. I'd like to rewrite it to use libcurl, but it is not clear to me how to do this. The command line I pass to popen() is: curl -s -S -D /dev/null -H "Content-Type: application/json" -X POST -d file-of-json http://server/handler.php The JSON data (about 3K) is