Reputation: 783
I am trying to POST content to URL using CURL. My code snippet is as follows
curl_easy_setopt(curl_handle, CURLOPT_PROXY, "proxy.xyz.com:8080");
curl_easy_setopt(curl_handle, CURLOPT_PROXYUSERPWD, "uname:password");
curl_easy_setopt(curl_handle,CURLOPT_POSTFIELDS, jsonResult.c_str());
curl_easy_setopt(curl_handle, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl_handle, CURLOPT_URL, "url");
curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L);
/* provide a buffer to store errors in */
curl_easy_setopt(curl_handle, CURLOPT_ERRORBUFFER, error);
res = curl_easy_perform(curl_handle);
if(res != CURLE_OK)
{
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
printf("unable to send data");
return false;
}
When I run above code snippet,it is always giving internal error - server connection terminated Can anyon eplease let me know what could be the cause and how to resolve
Thanks in advance
Upvotes: 0
Views: 14415
Reputation: 58164
That error message you see is actually in the HTTP response body - probably a response from the proxy given the meaning of it.
Upvotes: 0