I am trying to make an API for my website and so far for the GET and POST method it worked, but the DELETE method, I just can't get it to work. I know a lot of people have this issue but I could nowhere find the solution. If anyone can help me, thanks!
PS: Just to be clear, I do not have the WebDav module installed on the Windows Server.
This is my index.php:
<?php
require_once("DB.php");
$db = new DB("127.0.0.1", "SocialNetwork", "username", "pass");
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    if ($_GET['url'] == "auth") {
    } else if ($_GET['url'] == "users") {
    }
} else if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if ($_GET['url'] == "auth") {
            $postBody = file_get_contents("php://input");
            $postBody = json_decode($postBody);
            $username = $postBody->username;
            $password = $postBody->password;
            if ($db->query('SELECT username FROM users WHERE username=:username', array(':username'=>$username))) {
                    if (password_verify($password, $db->query('SELECT password FROM users WHERE username=:username', array(':username'=>$username))[0]['password'])) {
                            $cstrong = True;
                            $token = bin2hex(openssl_random_pseudo_bytes(64, $cstrong));
                            $user_id = $db->query('SELECT id FROM users WHERE username=:username', array(':username'=>$username))[0]['id'];
                            $db->query('INSERT INTO login_tokens VALUES (0, :token, :user_id)', array(':token'=>sha1($token), ':user_id'=>$user_id));
                            echo '{ "Token": "'.$token.'" }';
                    } else {
                            http_response_code(401);
                    }
            } else {
                    http_response_code(401);
            }
    }
} else if ($_SERVER['REQUEST_METHOD'] == "DELETE") {
if ($_GET['url'] == "auth") {
  if (isset($_GET['token'])) {
    $db->query('DELETE FROM login_tokens WHERE token=:token', array(':token'=>$_GET['token']));
    echo '{ "Status": "Success" }';
    http_response_code(200);
  } else {
    http_response_code(400);
    echo '{ "Error": "Mal-formed request" }';
  }
  }
} else {
    http_response_code(405);
}
?>
And this is my web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="API">
                <match url=".*" />
                <action type="Rewrite" url="index.php?url={R:0}" appendQueryString="false" />
            </rule>
        </rules>
    </rewrite>
    <modules>
        <remove name="WebDAVModule" />
    </modules>
    <handlers>
        <remove name="WebDAV" />
    </handlers>
    <security>
    <requestFiltering>
        <verbs allowUnlisted="false">
            <add verb="GET" allowed="true" />
            <add verb="POST" allowed="true" />
            <add verb="DELETE" allowed="true" />
            <add verb="PUT" allowed="true" />
        </verbs>
    </requestFiltering>
</security>
</system.webServer>
