How do I get parameters from a PUT request?

1

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;

Answer Print:

    
asked by anonymous 09.11.2016 / 13:52

1 answer

1

You can not use multipart/form-data to send PUT or DELETE Postman has an option to send requests as raw, use this way it should work

    
09.11.2016 / 14:32