I want to send a notification after firing an event in my website such as adding a post , adding a news or etc ...
I have done the requirements ,making a channel , adding a bot into it with administrtor role to send notification , get token , chat_id , finally I have made the link if I paste it in my browser's addressbar and press enter , that message will be send , but the problem is I can't run it automatically
here is my created Link :
https://api.telegram.org/bot[MY_Token]/sendMessage?chat_id=[MyChatId]&text=[My_TEXT]
please help me ..
private function sendTelegram($token,$chat_id,$text){
$url = "https://api.telegram.org/bot".$token."/sendMessage?chat_id=".$chat_id."&text=".$text.""; file_get_contents($url); }
here is my error : failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.