RealGas RealGas - 1 year ago 144
C++ Question

CURLOPT_POSTFIELDS sends data with strange encoding?

This is what I get

curl_easy_setopt(curl, CURLOPT_URL, "");
curl_easy_setopt(curl, CURLOPT_REFERER, "");
string data="abc";


Answer Source

CURLOPT_POSTFIELDS sends the data exactly as you pass to it, it doesn't translate, transcode or encode anything of it.

libcurl is a C API so you MUST provide the data as a plain char * and not a string. Use [string].c_str() or similar if you insist on using C++.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download