-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
46 lines (28 loc) · 1.26 KB
/
index.php
File metadata and controls
46 lines (28 loc) · 1.26 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
<?php
require_once 'Bot.php';
echo 'BOOooOT!';
$botToken = '448066609:AAFed17GD1yws3wV3AB4it_rWSt-yMdi6Ck';
$webSite = 'https://api.telegram.org/bot'.$botToken;
// $webSite = 'https://tgbot.test.maderwin.com/';
$update = file_get_contents ('php://input');
$updateArray = json_decode ($update,true);
$chatId = $updateArray['message']['chat']['id'];
$string = $webSite . '/sendmessage?chat_id=' . $chatId . '&text=test';
if($update){
// webhook
file_put_contents ('smth.txt',print_r($updateArray,true) . "<br><br>\n\n".'string= '.$string );
\Bot\Bot::execute();
} else {
//OUTPUT_SECTION
echo '<pre>';
$mysqli = new mysqli("localhost", "tgbot", "tgbot", "tgbot");
if ($mysqli->connect_errno) {
echo "Не удалось подключиться к MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
// if(file_exists('smth.txt')){
// var_dump(file_get_contents('smth.txt'));
// print_r( 'file_exists: ' .file_exists('smth.txt'));
// }
}
//https://api.telegram.org/bot448066609:AAFed17GD1yws3wV3AB4it_rWSt-yMdi6Ck/sendmessage?chat_id=304219410&text=test
//https://api.telegram.org/bot448066609:AAFed17GD1yws3wV3AB4it_rWSt-yMdi6Ck/sendmessage?chat_id=304219410&text=blabla