Telegram Bot API send message via file_get_contents()

To use this example you need to know the API key of your bot and the user id of the user you want to send the message to.
Of course, the user must have authorized the bot to send messages to him.

$botUrl          = "" . $BOT_TOKEN . "/";
$userId          = 00000000;

$url   = $botUrl."sendmessage?chat_id=".$userId."&text=.Maui is awesome!";
$response = file_get_contents($url);

Leave a Comment

Your email address will not be published. Required fields are marked *