How do I POST a buffer of JSON using libcurl?

后端 未结 4 1660
慢半拍i
慢半拍i 2021-02-02 15:08

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

4条回答
  •  迷失自我
    2021-02-02 15:32

    Also, you may use RAW input instead of adding extra backslashes:

    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, R"anydelim( {"hi" : "there"} )anydelim");
    

    with delimiter or without it.

提交回复
热议问题