This article mainly introduces the free message notification function, how to write the Telegram interface in PHP? Interested friends under the reference, I hope to be helpful to everyone.
Using telegram interface, can achieve very convenient message reminders, without opening the app, without scientific networking, telegram notifications like SMS reminders.
The point is, free, no limit on the amount of use, don't worry about text content review, you want to send anything.
Here is the code for sending notifications using PHP:
<?php$bot_api_key = ' change here '; function Send_get ($urlstring) {$ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $ URLString); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, Curlopt_ssl_verifypeer, 0); curl_setopt ($ch, curlopt_ssl_verifyhost, 0); $result = curl_exec ($ch); Curl_close ($ch); return $result;} $text = @$_get["text"]; $tgid = @$_get["Tgid"];if ($text) {$url = "https://api.telegram.org/bot$bot_api_key/sendmessage chat_id= $tgid &text= $text "; echo Send_get ($url);} else{echo "Please Input";}? >
Pass in two parameters, text and Tgid.