- Se incorporó
- 30 Julio 2006
- Mensajes
- 2.478
		PHP:
	
	<?php
   $update = json_decode(file_get_contents('php://input'), TRUE);
    $botToken = "MI_TOKEN";
    $botAPI = "https://api.telegram.org/bot" . $botToken;
   // Check if callback is set
    if (isset($update['callback_query'])) {
  $data = http_build_query([
            'text' => 'Rango seleccionado: ' . $update['callback_query']['data'],
            'chat_id' => $update['callback_query']['from']['id']
        ]);
        file_get_contents($botAPI . "/sendMessage?{$data}");
    }
    // Check for normal command
    $msg = $update['message']['text'];
    if ($msg === "/buscar") {
        // Create keyboard
        $data = http_build_query([
            'text' => 'Por favor seleccione un rango de busqueda;',
            'chat_id' => $update['message']['from']['id']
        ]);
      $keyboard = json_encode([
            "inline_keyboard" => [
                [
                    [
                        "text" => "A-F",
                        "callback_data" => "af"
                    ],
                    [
                        "text" => "G-L",
                       "callback_data" => "gl"
                    ]
                ]
            ]
        ]);
        // Send keyboard
        file_get_contents($botAPI . "/sendMessage?{$data}&reply_markup={$keyboard}");
    }el tema es que quiero agarrar el callback y usarlo para buscar en una tabla de base de datos y mostrar el resutados, la query no habria problemas ya que la variable se almacena en $update['callback_query']['data'],
 
 
		 
 
		 
 
		 
 
		