2023-04-09 19:52:26 +05:00
|
|
|
|
<?php
|
|
|
|
|
ini_set( 'display_errors', 0 );
|
|
|
|
|
//print_r($_POST);
|
|
|
|
|
if ($_POST['tel'] && $_POST['fio']){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// сюда нужно вписать токен вашего бота
|
|
|
|
|
define('TELEGRAM_TOKEN', '6155745196:AAEOe6gEYBgmgSoksmDC6nyTQEaEhtB7Z24');
|
|
|
|
|
|
|
|
|
|
// сюда нужно вписать ваш внутренний айдишник
|
2023-05-03 14:51:58 +05:00
|
|
|
|
define('TELEGRAM_CHATID', '598767621');
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function message_to_telegram($text)
|
|
|
|
|
{
|
|
|
|
|
$ch = curl_init();
|
|
|
|
|
curl_setopt_array(
|
|
|
|
|
$ch,
|
|
|
|
|
array(
|
|
|
|
|
CURLOPT_URL => 'https://api.telegram.org/bot' . TELEGRAM_TOKEN . '/sendMessage',
|
|
|
|
|
CURLOPT_POST => TRUE,
|
|
|
|
|
CURLOPT_RETURNTRANSFER => TRUE,
|
|
|
|
|
CURLOPT_TIMEOUT => 10,
|
|
|
|
|
CURLOPT_POSTFIELDS => array(
|
|
|
|
|
'chat_id' => TELEGRAM_CHATID,
|
|
|
|
|
'text' => $text,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
curl_exec($ch);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message_to_telegram('Заявка с сайта ' . $_SERVER['SERVER_NAME'] . ': ' . $_POST['fio'] . ' - ' . $_POST['tel']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|