Jump to content

php://input


jimfog

Recommended Posts

 

 

My purpose is that the same file/script processes also PUT requests.

My question is if there is a way the script can "understand" what type of request is made,POST or PUT.

 

Because different code/logic must apply for POST and different for PUT,unless the solution being creating a new file for the

PUT request.

 

Thanks.

Link to comment
Share on other sites

I haven't used that technique for reading response bodies, but according to the docs, since it just reads the raw request body, it should be accessible the same regardless of the request method (POST vs PUT, for example)

 

For HTTP requests for my API, I have chosen to use the Slim micro framework for handling various HTTP requests and routing accordingly.

Link to comment
Share on other sites

You'll find the request method in the $_SERVER array.http://www.php.net/manual/en/reserved.variables.server.php

Yes...this is the solution to my issue.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...