没有使用 Curlpp 的经验,但这就是我使用 libcurl 的方式。
您可以使用设置目标网址
curl_easy_setopt(m_CurlPtr, CURLOPT_URL, "http://urlhere.com/");
POST 值存储在一个链接列表中——您应该有两个变量来保存该列表的开头和结尾,以便 cURL 可以向其添加值。
struct curl_httppost* beginPostList;
struct curl_httppost* endPostList;
然后,您可以使用添加此 post 变量
curl_formadd(&beginPostList, &endPostList, CURLFORM_COPYNAME, "key", CURLFORM_COPYCONTENTS, "value", CURLFORM_END);
提交然后像这样工作
curl_easy_setopt(m_CurlPtr, CURLOPT_POST, true);
curl_easy_setopt(m_CurlPtr, CURLOPT_HTTPPOST, beginPostList);
curl_easy_perform(m_CurlPtr);
希望这可以帮助!