I'm using a u-blox gsm module (potentially irrelevant) to send POST commands to a server. I'm using http:/httpbin.org
(/post
) to echo back the POST information that Im sending. The result is
...
"args": {},
"data": "Hello World",
"files": {},
"form": {},
...
Thus suggesting that it's just data being received and not a file or parts of a form.
I've tried to use
<?php
echo "THIS IS THE SERVER RESPONSE:\n\n";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
print_r($_POST);
}
?>
but got an empty array back
THIS IS THE SERVER RESPONSE:
Array
(
)
What is the correct PHP command to use to echo the "data" back to the user?
Note: obviously in a real situation you wouldn't echo arbitrary data back to the user, that isn't the point here.