Сертификат:
RapidSSL
вот такие ошибки:
file_get_contents(): SSL: Handshake timed out in /home/www/bot.php on line 14
file_get_contents(): Failed to enable crypto in /home//www/bot.php on line 14
file_get_contents(
https://api.telegram.org/bot{KEY}/sendMessage?chat... failed to open stream: operation failed in /home/www/bot.php on line 14
Вот код:
const TOKEN = '{KEY}';
const BASE_URL = 'https://api.telegram.org/bot' . TOKEN . '/';
$update = json_decode(file_get_contents('php://input'), JSON_OBJECT_AS_ARRAY);
function sendRequest($method, $params = [])
{
if(!empty($params)) {
$url = BASE_URL . $method . '?' . http_build_query($params);
} else {
$url = BASE_URL . $method;
}
return json_decode(file_get_contents($url), JSON_OBJECT_AS_ARRAY);
}
$time = date('H:m:s');
$chat_id = $update['message']['chat']['id'];
sendRequest('sendMessage', ['chat_id' => $chat_id, 'text' => $time]);