我想从响应中获取回调数据,但数组为空。
我试图在消息callback_data数组中显示。
这是我的代码:
$botToken = "token";
$botAPI = "https://api.telegram.org/bot" . $botToken;
$update = json_decode(file_get_contents('php://input'), TRUE);
$message = $update["message"]["text"]
$chatId = $update["message"]["chat"]["id"];
$callback_query = $update['callback_query'];
$callback_query_data = $callback_query['data'];
$url = $botAPI . '/sendMessage?chat_id=' . $chatId . '&text=';
if(isset($callback_query)){
file_get_contents($url . $callback_query_data);
}
if($message == "/start"){
$parameters = array('chat_id' => $chatId, "text" => "????????????. ???????? ????. \n???????. ??????? ??????? ?????.\nHi! Select your language.");
$parameters["method"] = "sendMessage";
$keyboard = ['inline_keyboard' => [[
['text' => "??????", 'callback_data' => 'tajik'],
['text' => "???????", …Run Code Online (Sandbox Code Playgroud)