Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php send telegram message to user

function sendMessage($chatID, $messaggio, $token) {
    echo "sending message to " . $chatID . "
";

    $url = "https://api.telegram.org/bot" . $token . "/sendMessage?chat_id=" . $chatID;
    $url = $url . "&text=" . urlencode($messaggio);
    $ch = curl_init();
    $optArray = array(
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => true
    );
    curl_setopt_array($ch, $optArray);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #send #telegram #message #user
ADD COMMENT
Topic
Name
9+6 =