1
I am starting to study Web Service and created an example of an API in REST. I am passing parameters via PUT to the API and picking up with the parse_str
in PHP but what comes back 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;
Form you send is as Multipart/form-date?
– user59482
I’m actually using Postman to do the tests...
– Diogo Andrade
In Postman have the option to do with Multipart/form-data or send the request as raw. This is the last one you are using?
– user59482
No, I checked here and the form-date option is checked
– Diogo Andrade