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.