I set all requirements for PHP telegram bot by AWS EC2 instance, with PHP apache server, and work with https at https://waseem.com/index.php and webhook set also.
The problem I can get a response from my server to telegram everything well, I need help.
<?php
ob_start();
define('API_KEY','1208185634:AAFvkjZbth_xLZ8SzCtqIF-QafrLyttmdyU');
function bot($method,$json=[]){
$url = 'https://api.telegram.org/bot'.API_KEY.'/'.$method;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$json);
$res = curl_exec($ch);
if(curl_error($ch)){
var_dump(curl_error($ch));
}else{
return json_decode($res);
}
}
$update = json_decode(file_get_contents('php://input'));
$message = $update->message;
$msgID = $message->message_id;
$chatID = $message->chat->id;
$text = $message->text;
if ($text == '/start')
{
bot('sendMessage',['chat_id'=>$chatID,'text'=>'test']);
}