$content = file_get_contents("php://input"); $update = json_decode($content, true);
This is a webcam bot telegram.
if($update["message"]['text']=='start'): $chatID = $update["message"]["chat"]["id"]; // compose reply $reply = sendMessage(); // send reply $sendto =API_URL."sendmessage?chat_id=".$chatID."&text=".$reply; file_get_contents($sendto); endif;
with the start command sends a message
function sendMessage() { $message = urlencode("Для помощи нажмите /help. ".PHP_EOL."Для выбора города: /cities"); return $message; }
Everything works .. As soon as I try to add a connection to the database in this command and create a request .. to extract for example the name of the city and send the name of the city in a message. stops working .. Something missed and what I do not understand ..