发送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_READFUNCTION, NULL);
//设置数据接收和写入函数
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,...(curl, CURLOPT_TIMEOUT, 6);
// 开启post请求
res = curl_easy_perform(curl);
}
//释放curl
curl_easy_cleanup