I have a C client which use libcurl to send xml packet to Apache server via HTTPS.
some parts of the client code as:
curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/test.php");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, send_buf);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(send_buf));
curl_easy_setopt(curl, CURLOPT_POST, 1L);
res = curl_easy_perform(curl);
The content of send_buf is sent to https apache server (https://example.com/test.php), but on the Apache server side, how can I use test.php to get the content of send_buf? Any other scripts are welcome. thanks
Any example codes?
I may be a little unclear on your question, but I’m assuming send_buf is in the standard format, ie,
foo=bar&baz=boo&x=17+cats+etc
In that case, in your receiving PHP script (test.php) the $_POST variable will be initialized as follows:
So you can access a value by using $_POST[‘foo’].
Hope that helps.