-
Notifications
You must be signed in to change notification settings - Fork 0
/
execute.php
30 lines (24 loc) · 1.35 KB
/
execute.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
$content = file_get_contents("php://input");
//$content = '{"update_id":534691111,"message":{"message_id":246,"from":{"id":30343769,"is_bot":false,"first_name":"Daniele","username":"Wuzzifuzz","language_code":"it"},"chat":{"id":30343769,"first_name":"Daniele","username":"Wuzzifuzz","type":"private"},"date":1516969830,"text":"Deh"}}';
$update = json_decode($content, true);
if(!$update){
exit;
}
$message = isset($update['message']) ? $update['message'] : "";
$chatId = isset($message['chat']['id']) ? $message['chat']['id'] : "";
/*
$messageId = isset($message['message_id']) ? $message['message_id'] : "";
$firstname = isset($message['chat']['first_name']) ? $message['chat']['first_name'] : "";
$lastname = isset($message['chat']['last_name']) ? $message['chat']['last_name'] : "";
$username = isset($message['chat']['username']) ? $message['chat']['username'] : "";
$date = isset($message['date']) ? $message['date'] : "";
$text = isset($message['text']) ? $message['text'] : "";
$text = trim($text);
//$text = strtolower($text);
*/
header("Content-Type: application/json");
$parameters = array('chat_id' => $chatId, "text" => $content);
$parameters["method"] = "sendMessage";
//$parameters["reply_markup"] = '{ "keyboard": [["uno", "due"], ["tre", "quattro"], ["cinque"]], "resize_keyboard": true, "one_time_keyboard": false}';
echo json_encode($parameters);