<?php include "html-head.php"; ?>
    
    <title>Discord Webhook API</title>

</head>

<body>
    
    <label for="username">Name:</label><br>
    <input type="text" id="username" name="username" required>
    <br><br>
    <label for="avatar_url">Avatar URL:</label><br>
    <input type="text" id="avatar_url" name="avatar_url" required>
    <br><br>
    <label for="message">Nachricht:</label><br>
    <textarea id="message" name="message" required></textarea>
    <br><br>
    <button onclick="sendMessage()">Nachricht senden</button>
    
    <script>
        function sendMessage() {
            var request = new XMLHttpRequest();
            var username = document.getElementById("username").value;
            var avatar_url = document.getElementById("avatar_url").value;
            var message = document.getElementById("message").value;
            request.open("POST", "https://discord.com/api/webhooks/810505594678280203/mnxaBTlCwZJstK_mXevDJ21PbdJdu0a0VtqEv2cyCEMNdO0zXzLnqW8Dk2yRmzl7V67w");
            request.setRequestHeader('Content-type', 'application/json');
            var paramaters = {
              username: username,
              avatar_url: avatar_url,
              content: message
            }
            request.send(JSON.stringify(paramaters));
            alert("Nachricht gesendet");
        }
    </script>

</body>

</html>