1
URLでAnswerInlineQueryを作成するにはどうすればよいですか? URLでアンサーインラインクエリを作成する方法
$data = array();
$data['inline_query_id']= $inline_query_id;//sample : 1515027006022511114
$data['results']='[
{
"type": "article",
"id": "001",
"title": "UC Browser",
"message_text": "Text of the first message",
"parse_mode": "Markdown",
"disable_web_page_preview": true,
"url": "telegram.com",
"hide_url": true,
"description": "Optional. Short description of the result",
"thumb_url": "http://icons.iconarchive.com/icons/martz90/circle/64/uc-browser-icon.png",
"thumb_width": 64,
"thumb_height": 64
},
{
"type": "article",
"id": "002",
"title": "Bitcoin",
"message_text": "*Text of the second message*",
"parse_mode": "Markdown",
"disable_web_page_preview": true,
"url": "bitcoin.org",
"hide_url": true,
"description": "Short description of the result",
"thumb_url": "http://www.coinwarz.com/content/images/bitcoin-64x64.png",
"thumb_width": 64,
"thumb_height": 64
}
]';
$ch = curl_init();
$curlConfig = array(
CURLOPT_URL => 'https://api.telegram.org/bot' . TOKEN . '/answerInlineQuery',
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_POSTFIELDS => 'params=' . json_encode($data),
CURLOPT_VERBOSE => true,
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
curl_close($ch);
しかし、結果
:私はこれを試してみました、私はこの(URLポストではなく、クラス)のようにコーディングする必要がある、すべてのサンプルコードは電報SDKについてです、をそのクエリの任意のより詳細な情報を見つけることができません次のとおりです。
Result : {"ok":false,"error_code":400,"description":"Bad Request: QUERY_ID_INVALID"}
と私もこれを試してみました:
$mResult = '[
{
"type": "article",
"id": "001",
"title": "UC Browser",
"message_text": "Text of the first message",
"parse_mode": "Markdown",
"disable_web_page_preview": true,
"url": "telegram.com",
"hide_url": true,
"description": "Optional. Short description of the result",
"thumb_url": "http://icons.iconarchive.com/icons/martz90/circle/64/uc-browser-icon.png",
"thumb_width": 64,
"thumb_height": 64
},
{
"type": "article",
"id": "002",
"title": "Bitcoin",
"message_text": "*Text of the second message*",
"parse_mode": "Markdown",
"disable_web_page_preview": true,
"url": "bitcoin.org",
"hide_url": true,
"description": "Short description of the result",
"thumb_url": "http://www.coinwarz.com/content/images/bitcoin-64x64.png",
"thumb_width": 64,
"thumb_height": 64
}
]';
$url= "https://api.telegram.org/bot" . TOKEN . "/answerInlineQuery?inline_query_id=" . $inline_query_id . "&results=" . json_encode($mResult);
file_get_contents($url);
をし、これが返されます。
Result : {"ok":false,"error_code":400,"description":"Bad Request: QUERY_ID_INVALID"}