I'm currently dealing with HTTP POST requests in C++ and I encountered an error. When I set my POST data with :
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postdata.c_str());
postdata.c_str()
was equals :
cpp=1&data=zJBnu/hyK+xgm1tUOM22bL9h/9BVdqss7uc5uLHJ65lLHSTzQCSdgA36cz0/xb3juGGtSjm8P9m+4Ee6B6ot4IxMhuJBH5x3Co6L35tZRg7BhxTWO29UMtgitEo/OPBSiRVX/doZwlNBPm3v8ZRgjH8PT/W/VajqZYGvIvwK1cgBdrTeRCLE1nkEdQ2O0lg00VCU2amSBc4faty/RtTZYflpc+PQl9YKvsC+F09uZVKHORKfJPnIxg1SLUSuXNfzItJOR+VF1GVRcQmYDvVoW5JHiejMjnrVNnIMpmU35y0mzywZLYn1XUL9NhFHLTAGfxsttiTmZOLY7dgCBWTPng==&mode=0
. It's some parameters as Key/Value pair. Data
here is base64 encoded.
But when I did the curl_perform(), the value of data
was not the same. All the +
was replaced by spaces. So PHP base64_decode($_POST['data'], true);
function return false
.
I tried by different ways to avoid it C++ side but nothing works.