(C++) libCURL POST get response back issue

Started by
0 comments, last by md_lasalle 12 years, 4 months ago
Hello, this might seem obvious to some of you that has experience with libcurl, but for some reason I'm fiddling with this and can't put my finger on the problem.

This is the code that sends the POST to a php page, it works 100%, as on the server I insert a record in a database when I receive the data, and all is fine.



CURL* easyhandle = curl_easy_init();
if( easyhandle )
{
m_recBuf = new char[1024];
curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS, data);
curl_easy_setopt(easyhandle, CURLOPT_URL, m_url.c_str());
curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, &WebQuery::WriteData);
curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, m_recBuf);
}
res = curl_easy_perform(easyhandle); /* post away! */

EDIT: curl_easy_perform returns CURLE_GOT_NOTHING(52)

My issue now is that I need to find a way to get some response back from the call, I have declared a static function :



size_t WebQuery::WriteData( char *ptr, size_t size, size_t nmemb, void *userdata)
{
return size;
}


Even with a breakpoint, "return size;" never gets hit.


On the server, in the php script, I echo this :

echo "OK";

Is this the way a response should be sent ?
Why is my WriteData function never called ?

Thanks everyone.
EDIT2: Seems that I may be facing a firewall issue on the serverside.
Advertisement
For those of you interested, the issue was a bug in libcurl 7.16.1, updated to 7.32.1 and now everything works as expected.

This topic is closed to new replies.

Advertisement