0

I am writing a telegram to the php bot, it works fine, but it sends the same message many times, it needs to be sent once, can anyone help me? here is my code

function chat_telegram( )
{
    $token = <token>;
    $telegram = "https://api.telegram.org/bot" . $token;
    $query = http_build_query([
        'chat_id' => <chat_id>,
        'text' => 'I love pizza'
    ]);

    $response = file_get_contents( $telegram . '/sendMessage?' . $query );
    return $response;
}

0 Answers0