一个比较奇葩的用法get请求,但参数放到body里
//curl_easy_setopt(pCurl, CURLOPT_POST, isPost);
if (isPost)
{
curl_easy_setopt(pCurl, CURLOPT_CUSTOMREQUEST, "POST");
}
else
{
curl_easy_setopt(pCurl, CURLOPT_CUSTOMREQUEST, "GET");
}
curl_easy_setopt(pCurl, CURLOPT_POSTFIELDSIZE, nBytes);
curl_easy_setopt(pCurl, CURLOPT_POSTFIELDS, lpBuffer);
需要用curl_easy_setopt(pCurl, CURLOPT_CUSTOMREQUEST, "GET");指定get方法,
curl_easy_setopt(pCurl, CURLOPT_POST, isPost);无效
本文介绍了一种不常见的GET请求实现方式,即通过将参数放置在请求体中而非URL上进行发送,并展示了使用libcurl库的具体设置方法。

1770

被折叠的 条评论
为什么被折叠?



