Как получить GET запрос, и отправить его в Telegram
как получить Get запрос уникального ID из адрессной строки и отправить вместе с формой в телеграм?
Выглядит примерно так: domain.com?id=324 > получаем Get запрос id=324 > добавляем его в форму и отправляем в телеграм.
Вот мой код:
<?php
$name = $_POST['user_name'];
$telegram = $_POST['user_telegram'];
$description = $_POST['user_description'];
$id = $_GET['id'];
$token = "5249994103:AAHZ8y_aQ3HcnbBrhxoLrtkDxspsqH610Pg";
$chat_id = "-753826972";
$arr = array(
'id: ' => $id,
'Name: ' => $name,
'Telegram: ' => $telegram,
'Description' => $description
);
foreach($arr as $key => $value) {
$txt .= "<b>".$key."</b> ".$value."%0A";
};
$sendToTelegram = fopen("https://api.telegram.org/bot{$token}/sendMessage?chat_id={$chat_id}&parse_mode=html&text={$txt}","r");
if ($sendToTelegram) {
header('Location: /success');
} else {
echo "Error";
}
?>
Но по итогу, мне приходит форма в телеграм с пустым ID.
