File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -128,19 +128,26 @@ You must set a [WebHook](https://core.telegram.org/bots/api#setwebhook)
128
128
Create * set.php* (just edit * example-set.php* ) and put into it:
129
129
``` php
130
130
<?php
131
+ //Composer Loader
131
132
$loader = require __DIR__.'/vendor/autoload.php';
132
133
133
134
$API_KEY = 'your_bot_api_key';
134
135
$BOT_NAME = 'namebot';
135
-
136
+ $link = 'https://yourdomain/yourpath_to_hook.php';
136
137
try {
137
138
// create Telegram API object
138
139
$telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);
139
140
// set webhook
140
- echo $telegram->setWebHook('https://yourdomain/yourpath_to_hook.php');
141
+ $result = $telegram->setWebHook($link);
142
+ if ($result->isOk()) {
143
+ echo $result->getDescription();
144
+ }
141
145
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
142
146
echo $e->getMessage();
143
147
}
148
+
149
+
150
+
144
151
```
145
152
And open your * set.php* via browser.
146
153
Original file line number Diff line number Diff line change 4
4
5
5
$ API_KEY = 'your_bot_api_key ' ;
6
6
$ BOT_NAME = 'namebot ' ;
7
-
7
+ $ link = ' https://yourdomain/yourpath_to_hook.php ' ;
8
8
try {
9
9
// create Telegram API object
10
10
$ telegram = new Longman \TelegramBot \Telegram ($ API_KEY , $ BOT_NAME );
11
11
// set webhook
12
- echo $ telegram ->setWebHook ('https://yourdomain/yourpath_to_hook.php ' );
12
+ $ result = $ telegram ->setWebHook ($ link );
13
+ if ($ result ->isOk ()) {
14
+ echo $ result ->getDescription ();
15
+ }
13
16
} catch (Longman \TelegramBot \Exception \TelegramException $ e ) {
14
17
echo $ e ->getMessage ();
15
18
}
You can’t perform that action at this time.
0 commit comments