Created
June 9, 2021 14:37
-
-
Save LeonelF/42932479fdf52bfe1e3c28d27a669c84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function telegram($chat_id,$message) { | |
$botToken = "BOT TOKEN HERE"; | |
$url="https://api.telegram.org/bot". $botToken ."/sendMessage"; | |
$params= array('chat_id' => $chat_id, 'parse_mode' => 'HTML', 'text' => $message); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $params); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
} | |
//Usage | |
telegram(CHATID,"<b>TESTE MESSAGE</b>". chr(10) ."NAICE: <b>IT WORKS!</b>"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment