Answer the question
In order to leave comments, you need to log in
How to correctly pass base64 post request to c++ using curl library?
I'm doing a post request to index.php file <?php echo $_POST["body"] ?>
In C++ using curl lib.
If you substitute just the string "body=123" - the result will be positive.
If I substitute the base64 code I need - the request breaks
Here is a piece of code
Please help me solve the problem
Answer the question
In order to leave comments, you need to log in
https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
there is C++ libcurl bindings
sources curl_easy_setopt wrapper over
static CURLcode vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
case CURLOPT_POSTFIELDS:
/*
* Like above, but use static data instead of copying it.
*/
data->set.postfields = va_arg(param, void *); // Тут <-----------------------<<<<
/* Release old copied data. */
(void) Curl_setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);
data->set.httpreq = HTTPREQ_POST;
break;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question