Answer the question
In order to leave comments, you need to log in
Why is a message not sent to telegram via php?
Good day. Faced the problem of sending a message to telegram from the site. The site is made on yii2. The mechanism is like this, a person places an order and a message about a new order comes to the admin in telegrams. Everything works fine on openserver, but when I uploaded it to the hosting, difficulties started (
allow_fopen_url is enabled.
here is the error:
fopen(https://api.telegram.org/bot1235530239:AAEm4k2m3w2xl6GrBdfx_B4PB0PUfLW5nxU/sendMessage?chat_id=-402381614&parse_mode=html&text=Новый заказ!): failed to open stream: Network is unreachable
{"ok":false,"error_code":400,"description":"Bad Request: message text is empty"}
$token = "**********";
$chat_id = "**********";
$sendToTelegram = fopen("https://api.telegram.org/bot{$token}/sendMessage?chat_id={$chat_id}&parse_mode=html&text=Новый заказ!","r");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question