C++ IOS支付
void AKHandleNet::curlSendHttpThread(HttpSenderInfo* pHttpSenderInfo)
{
std::string strUrl = pHttpSenderInfo->strUrl;
CURL *header = curl_easy_init();
curl_easy_setopt(header, CURLOPT_URL, pHttpSenderInfo->strUrl.c_str());
curl_easy_setopt(header, CURLOPT_HEADER, 1);
curl_easy_setopt(header, CURLOPT_NOBODY, 1);
curl_easy_setopt(header, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(header, CURLOPT_CONNECTTIMEOUT, DEFAULT_TIMEOUT);
curl_easy_setopt(header, CURLOPT_TIMEOUT, DEFAULT_TIMEOUT);
curl_easy_setopt(header, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(header, CURLOPT_HEADER, 0);
curl_easy_setopt(header, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(header, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(header, CURLOPT_WRITEFUNCTION, writeDataCURL);
curl_easy_setopt(header, CURLOPT_WRITEDATA, pHttpSenderInfo);
if (pHttpSenderInfo->nSendType == 0)
{
strUrl += "?";
strUrl += pHttpSenderInfo->strUrlParam;
}
else {
curl_easy_setopt(header, CURLOPT_POST, 1L);
curl_easy_setopt(header, CURLOPT_COPYPOSTFIELDS, pHttpSenderInfo->strUrlParam.c_str());
}
CURLcode ret = curl_easy_perform(header);
long responseCode = 0;
const char* pszError = NULL;
if (ret != 0)