发送post请求代码如下:
#include
#include
#include
using namespace std;
//get请求和...post请求数据响应函数
size_t req_reply(void *ptr, size_t size, size_t nmemb, void *stream)
{
//在注释的里面可以打印请求流..., 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