CURL *curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1); // Forbid keepalive connections. curl_easy_setopt(curl, CURLOPT_USERAGENT, useragent.c_str()); curl_easy_setopt(curl, CURLOPT_PROXY, proxyserver.c_str()); curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, proxyinfo.c_str()); curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curl_header_write); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, this); curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_debug_callback); if (proxyauth) { curl_easy_setopt(curl, CURLOPT_USERPWD, proxyinfo.c_str()); curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY); } else { curl_easy_setopt(curl, CURLOPT_PROXYAUTH, 0); } curl_easy_setopt(curl, CURLOPT_TIMEOUT , 30); if (!readytosubmit) { curl_easy_setopt(curl, CURLOPT_HTTPGET, 1); curl_easy_setopt(curl, CURLOPT_URL, hsstring.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, hs_write_data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, this); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curlerror); } else { curl_easy_setopt(curl, CURLOPT_POSTFIELDS, submit.c_str()); curl_easy_setopt(curl, CURLOPT_URL, submiturl.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, submit_write_data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, this); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curlerror); } WaitForSingleObject(curlmutex, INFINITE); success = curl_easy_perform(curl);