jimfog Posted April 1, 2014 Share Posted April 1, 2014 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 More sharing options...
thescientist Posted April 1, 2014 Share Posted April 1, 2014 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 More sharing options...
justsomeguy Posted April 1, 2014 Share Posted April 1, 2014 You'll find the request method in the $_SERVER array.http://www.php.net/manual/en/reserved.variables.server.php Link to comment Share on other sites More sharing options...
jimfog Posted April 1, 2014 Author Share Posted April 1, 2014 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now