<?php
    function sendMessageToWebhook($webhook, $title, $message)
    {
        $RAWmessage = file_get_contents("style/discordMessage.json");
        $RAWmessage = str_replace("%%message%%", $message, $RAWmessage);
        $RAWmessage = str_replace("%%title%%", $title, $RAWmessage);

        $options = [
            'http' => [
                'method' => 'POST',
                'header' => 'Content-Type: application/json',
                'timeout' => 3,
                'content' => $RAWmessage
            ]
        ];

        $result = file_get_contents($webhook, false, stream_context_create($options));
    }
?>