File: /home/geyhairs/www/kvih6/send_to_telegram.php
<?php
// send_to_telegram.php
header('Content-Type: application/json');
// التوكن معرف هنا في PHP - مخفي عن العميل
define('BOT_TOKEN', '8538335658:AAErc6Hfabnfgu6OUPRmsgdUxn6NzADnm5Y');
define('CHAT_ID', '5075680045');
// استقبال البيانات
$input = json_decode(file_get_contents('php://input'), true);
if (!$input || !isset($input['message'])) {
http_response_code(400);
echo json_encode(['error' => 'Invalid data']);
exit;
}
$message = $input['message'];
// إرسال الرسالة النصية للتلجرام
$telegramUrl = "https://api.telegram.org/bot" . BOT_TOKEN . "/sendMessage";
$messageData = [
'chat_id' => CHAT_ID,
'text' => $message,
'parse_mode' => 'HTML'
];
$ch = curl_init($telegramUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($messageData));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
echo json_encode(['success' => true]);
?>