19 lines
612 B
PHP
19 lines
612 B
PHP
<?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
|
|
]
|
|
];
|
|
|
|
file_get_contents($webhook, false, stream_context_create($options));
|
|
}
|