php send telegram message to user

Solutions on MaxInterview for php send telegram message to user by the best coders in the world

showing results for - "php send telegram message to user"
Sean
17 Apr 2018
1function sendMessage($chatID, $messaggio, $token) {
2    echo "sending message to " . $chatID . "\n";
3
4    $url = "https://api.telegram.org/bot" . $token . "/sendMessage?chat_id=" . $chatID;
5    $url = $url . "&text=" . urlencode($messaggio);
6    $ch = curl_init();
7    $optArray = array(
8            CURLOPT_URL => $url,
9            CURLOPT_RETURNTRANSFER => true
10    );
11    curl_setopt_array($ch, $optArray);
12    $result = curl_exec($ch);
13    curl_close($ch);
14    return $result;
15}
16
Lilli
05 Sep 2018
1$token = "<insert bot token here>";
2$chatid = "<chatID>";
3sendMessage($chatid, "Hello World", $token);
4