How to get PUT/DELETE arguments in PHP

Unfortunately php does not handle put or delete requests by default. I have created a library in order to handle this kind of requests. It also handles multipart requests (PUT PATCH DELETE etc)

You can find it here https://github.com/notihnio/php-request-parser


Can you try this, PHP doesn't have a built-in way to do this, can be read from the incoming stream to PHP, php://input.

 parse_str(file_get_contents("php://input"));

EX:

  if($_SERVER['REQUEST_METHOD'] == 'GET') {
    echo "this is a get request\n";
    echo $_GET['fruit']." is the fruit\n";
    echo "I want ".$_GET['quantity']." of them\n\n";
} elseif($_SERVER['REQUEST_METHOD'] == 'PUT') {
    echo "this is a put request\n";
    parse_str(file_get_contents("php://input"),$post_vars);
    echo $post_vars['fruit']." is the fruit\n";
    echo "I want ".$post_vars['quantity']." of them\n\n";
}

Ref: http://www.lornajane.net/posts/2008/accessing-incoming-put-data-from-php