Answer the question
In order to leave comments, you need to log in
How to send a notification to telegram from the site?
I am writing a site not of mass use, it is required that when entering it, it sends a message to the telegram conversation, where there is this bot of the type: "The user followed the link / to the site."
Answer the question
In order to leave comments, you need to log in
$BOT_TOOKEN = '-------------token from bot father ------------';
$to = тид получателя;
$message = 'that you need ';
$parameters = array('chat_id' => $to, 'parse_mode' => 'HTML', "text" => $message);
$url = "https://api.telegram.org/bot" . trim($BOT_TOOKEN) . '/sendMessage?' . http_build_query($parameters);
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($handle, CURLOPT_TIMEOUT, 60);
$response = curl_exec($handle);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question