Jump to content
  • Advertisement
Sign in to follow this  
md_lasalle

(C++) libCURL POST get response back issue

This topic is 2558 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!