发送post请求代码如下:
#include
#include
#include
using namespace std;
//get请求和...//设置curl的请求头
struct curl_slist* header_list = NULL;
header_list = curl_slist_append(header_list,..., 0);
//设置请求为post请求
curl_easy_setopt(curl, CURLOPT_POST, 1);
//设置请求的URL地址
curl_easy_setopt(...curl, CURLOPT_URL, url.c_str());
//设置post请求的参数
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postParams.c_str...(curl, CURLOPT_TIMEOUT, 6);
// 开启post请求
res = curl_easy_perform(curl);
}
//释放curl
curl_easy_cleanup