'Telegram bot doesn't answer

I'm using the package of eleirbag89 http://eleirbag89.github.io/TelegramBotPHP to create my bot on telegram.

I'm having some issues on it, it doesn't answer me on telegram but the code is correct (it answered in the past and nothing has changed).

How can I debug the code to see if everything is good?

Could be a problem of SSL certificate?

This is the simple code I used to test the bot after the issue:

require '../vendor/autoload.php';

$BOT_TOKEN = "[bot:token]";

$telegram = new Telegram($BOT_TOKEN);

$result = $telegram->getData();
$text = $result['message']['text'];
$chat_id = $result['message']['chat']['id'];

if ($text == "/test") {
    $msg = 'Test is good';
    $content = array('chat_id' => $chat_id, 'text' => $msg);
    $telegram->sendMessage($content);
}

But it doesn't answer me :(



Solution 1:[1]

$token = "Token";
$link01 = "https://api.telegram.org/bot".$token;

$updates = file_get_contents('php://input');
$updates = json_decode($updates, TRUE);

$msgID = $updates['message']['from']['id'];
$name = $updates['message']['from']['first_name'];

try this one.

Could be a problem of SSL certificate? YES

You need to set webhook, Only you can set webhook, If it is HTPS

Here is how to set web hook

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Geethika Wijesuriya