I'm starting to study Web Service and created an example of an API in REST. I'm passing parameters via PUT to the API and catching with parse_str
in PHP but what returns to me is something completely different ...
How do I get the parameters correctly to consume my API?
My code:
case "PUT":
echo "PUT<br /><br />";
echo "Inputs:<br/>";
parse_str(file_get_contents("php://input"),$put_vars);
echo "<br/>JSON:<br/>";
echo json_encode($put_vars);
echo "<br/><br/>Array comum:<br/>";
print_r($put_vars);
break;