$data = file_get_contents('php://input');
function set_log($message, $prefix) {
$log = date('Y-m-d H:i:s') . ' ' . print_r($message, true);
file_put_contents('zina_log/'.$
prefix.date('Y-m-d').'log.txt', $log . PHP_EOL, FILE_APPEND);
}
$data = json_decode($data, true);
set_log($data, 'input_');
define('TOKEN', 'токен');
// Функция вызова методов API.
function sendTelegram($method, $response)
{
$ch = curl_init('
https://api.telegram.org/bot' . TOKEN . '/' . $method);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $response);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
$res = curl_exec($ch);
curl_close($ch);
set_log($res, 'response_');
return $res;
}