I'm trying to perform a post from c++. I'm getting a segmentation fault
when calling the curl_easy_perform. I'm new to curl, but this is my code
so far.
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if ( curl )
{
curl_easy_setopt( curl, CURLOPT_PROXY, "IP_OF_PROXY_AND_PORT" );
curl_easy_setopt( curl, CURLOPT_URL, "http://posttestserver.com/post.php" );
curl_easy_setopt( curl, CURLOPT_POSTFIELDS, data.c_str() );
// if we don't provide POSTFIELDSIZE, libcurl will strlen() by itself
curl_easy_setopt( curl, CURLOPT_POSTFIELDSIZE, data.c_str());
res = curl_easy_perform( curl );
// always cleanup
curl_easy_cleanup( curl );
}
--
Mauricio Ramirez
Programmer Analyst
Public Safety Fire Dispatch Division
(213) 484 - 6773
There are two ways to write error-free programs; only the third one works.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html