Answer the question
In order to leave comments, you need to log in
How to write data to a variable from a GET request?
When they register on the site, the site sends a GET request to the bot
Answer the question
In order to leave comments, you need to log in
This data comes to the bot's chat with you, so we can read it and write it anywhere. Something like this would be in php
$data = json_decode(file_get_contents('php://input'), true);
if (array_key_exists("message", $data)) {
$text = $data['message']['text']; // здесь полученный текст ID_USER=66544456?Prime=3
// парсим текст $param[0] - id_user $param[1]- prime
$param = explode('?', $text);
// если нужны значения отдельно, то еще раз парсим ID_USER=66544456
// $user = explode('=', $param[0]);
// записываем в БД
$insert = $this->pdo->prepare("INSERT INTO user SET user_id = ?, prime = ?");
$insert->execute(['$param[0], $param[1]]);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question