The scenario is as follows, I want to send messages or notifications (without commands sent by users) every minute on a Telegram channel.
It happens that I can send the messages every time I enter the URL and the message is sent, but I want it to be sent automatically (without entering the URL) every minute. I do not know how to do that, thanks in advance.
<?php $botToken="<<BOT-TOKEN>>" ; $website="https://api.telegram.org/bot" .$botToken; $chatId="337957895" ; //**===>
NOTE: this chatId MUST be the chat_id of a person, NOT another bot chatId !!!** $params=[ 'chat_id'=>$chatId, 'text'=>'This is my message !!!', ]; $ch = curl_init($website . '/sendMessage'); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 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); ?>
I have to enter the URL still for the message to be sent ... https://bot.unpixelmas.com/bot.php