Below I reported a simple code that allows me to know my current location by clicking the "Current location" button. Once I sent the location I would like to be able to send a message showing the latitude and longitude of the location. I don’t know how to interact with the location sent by Telegram, can you help me?
<?php
define ('url',"https://api.telegram.org/bot[botToken]/");
$update= file_get_contents('php://input');
$update= json_decode($update, TRUE);
$chatId= $update['message']['from']['id'];
$text= $update['message']['text'];
$button= '[{"text":"Current location", "request_location": true}]';
position($chatId, "Click the button to share your location", $button);
function position($IdChat, $text, $tastiera){
$tastierino = '&reply_markup={"keyboard":['.$tastiera.'],"resize_keyboard": true,"one_time_keyboard": true}';
$url= url."sendMessage?chat_id=$IdChat&parse_mode=HTML&text=".urlencode($text).$tastierino;
file_get_contents($url);
}
?>