Php 电报机器人如何获得ChosenInlineResult
如何在此结果中获得ChosenInlineResult?: 我正在使用PHP,这是我的发送结果页面Php 电报机器人如何获得ChosenInlineResult,php,telegram-bot,Php,Telegram Bot,如何在此结果中获得ChosenInlineResult?: 我正在使用PHP,这是我的发送结果页面 $results = array( array( "type" => "article", "id" => "1", "title" => "aaaa", "description" => "bbbb",
$results = array(
array(
"type" => "article",
"id" => "1",
"title" => "aaaa",
"description" => "bbbb",
"input_message_content" => array(
"message_text" => "mt",
"parse_mode" => "HTML"
),"reply_markup" => array('inline_keyboard' => ($keyboardx))
)
);
$data = array(
"inline_query_id" => $qid,
"results" => json_encode($results),
"cache_time" => 0
);
$data_string = json_encode($data);
$ch = curl_init('https://api.telegram.org/'.$token.'/answerInlineQuery');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
file_put_contents("res.txt",$result,FILE_APPEND);
在这里,我将返回的数据保存在res.txt中,您需要转到并将/setinlinefeedback
设置为启用,以便接收ChosenInlineResult
。之后,当选择了InlineQueryResult
时,您将收到一条带有ChosenInlineResult
的消息
{
"update_id" : 123456789,
"chosen_inline_result" : {
//[...]
}
}