Answer the question
In order to leave comments, you need to log in
Telegram PHP API how to get data from object?
I'm trying to get data from the User object from the telegrams of the bot, but for some reason I get an empty variable instead, please tell me what I'm doing wrong:
$data = json_decode(file_get_contents('php://input'));
function tgQuery($method, $params)
{
file_get_contents("https://api.telegram.org/bot".TOKEN."/".$method."?".$params);
}
$varg = $data->User->id;
tgQuery("sendMessage", "chat_id=".$data->message->chat->id."&text=TexL: ".$varg.".");
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