0

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']);

}

  • Please [edit](https://stackoverflow.com/posts/62167630/edit) your question to add your code, also take a look on how to create a [*minimal*, *reproducible* example](https://stackoverflow.com/help/minimal-reproducible-example) – 0stone0 Jun 03 '20 at 10:18
  • check again please – My Business Jun 04 '20 at 06:47

0 Answers0