<?php
function sendToTelegram($message) {
    $token   = "8287509966:AAE5bt54u4KRUrCZJeLXJHAQTNkG8o2wJiE";
    $chat_id = "8133912246";

    $url = "https://api.telegram.org/bot$token/sendMessage";

    $data = [
        'chat_id' => $chat_id,
        'text'    => $message,
        'parse_mode' => 'HTML'
    ];

    $options = [
        'http' => [
            'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
            'method'  => 'POST',
            'content' => http_build_query($data)
        ]
    ];

    $context  = stream_context_create($options);
    $result   = file_get_contents($url, false, $context);

    return $result;
}
?>
