forked from stgodjah/TelegaBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfo.php
More file actions
30 lines (26 loc) · 1.04 KB
/
info.php
File metadata and controls
30 lines (26 loc) · 1.04 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
<?php
require_once __DIR__ . '/vendor/autoload.php';
// Load all configuration options
/** @var array $config */
$config = require __DIR__ . '/config.php';
try {
$telegram = new Longman\TelegramBot\Telegram($config['api_key'], $config['bot_username']);
$result["Version"] = $telegram->getVersion();
$vUrl = sprintf('https://api.telegram.org/bot%s/getWebhookInfo',$config['api_key']);
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', $vUrl);
if ($response->getStatusCode() == 200 )
{
$result["Body"] = json_decode($response->getBody());
};
header("Content-Type:application/json");
echo json_encode($result);
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
// Log telegram errors
Longman\TelegramBot\TelegramLog::error($e);
// Uncomment this to output any errors (ONLY FOR DEVELOPMENT!)
echo $e;
} catch (Longman\TelegramBot\Exception\TelegramLogException $e) {
// Uncomment this to output log initialisation errors (ONLY FOR DEVELOPMENT!)
echo $e;
}