1
0
Fork 0
Manager/app/discord.php

19 lines
612 B
PHP
Raw Normal View History

2021-01-20 23:29:57 +00:00
<?php
function sendMessageToWebhook($webhook, $title, $message)
{
2023-08-27 03:31:32 +00:00
$rawMessage = file_get_contents("style/discordMessage.json");
$rawMessage = str_replace("%%message%%", $message, $rawMessage);
$rawMessage = str_replace("%%title%%", $title, $rawMessage);
2021-01-20 23:29:57 +00:00
$options = [
'http' => [
'method' => 'POST',
'header' => 'Content-Type: application/json',
'timeout' => 3,
2023-08-27 03:31:32 +00:00
'content' => $rawMessage
2021-01-20 23:29:57 +00:00
]
];
2023-08-27 03:31:32 +00:00
file_get_contents($webhook, false, stream_context_create($options));
2021-01-20 23:29:57 +00:00
}