Reputation: 7169
I tried with $_PUT
, but looks like that this variable doesn't exist. There are only $_GET
and $_POST
and $_REQUEST
which also just holds GET
, POST
and cookies
.
Upvotes: 0
Views: 97
Reputation: 7169
I ended up with this:
if($_SERVER['REQUEST_METHOD'] == 'PUT') {
echo 'This is a HTTP PUT request.<br />';
parse_str(file_get_contents('php://input'), $put);
echo $put['user'] . '<br /><br />';
}
Upvotes: 0
Reputation: 3900
There is no such thing as "PUT parameters". The HTTP request that is sent with PUT method contains request body. This body can be read from php://input
stream.
I found a blog post that describes how the request body can be parsed, if PUT method is used to send POST-like parameters: http://www.chlab.ch/blog/archives/webdevelopment/manually-parse-raw-http-data-php
Upvotes: 2