Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
c7438436
Commit
c7438436
authored
Sep 15, 2015
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX set webhook bug
parent
e5d6c3ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
README.md
README.md
+9
-2
example-set.php
example-set.php
+5
-2
No files found.
README.md
View file @
c7438436
...
...
@@ -128,19 +128,26 @@ You must set a [WebHook](https://core.telegram.org/bots/api#setwebhook)
Create
*set.php*
(just edit
*example-set.php*
) and put into it:
```
php
<?php
//Composer Loader
$loader
=
require
__DIR__
.
'/vendor/autoload.php'
;
$API_KEY
=
'your_bot_api_key'
;
$BOT_NAME
=
'namebot'
;
$link
=
'https://yourdomain/yourpath_to_hook.php'
;
try
{
// create Telegram API object
$telegram
=
new
Longman\TelegramBot\Telegram
(
$API_KEY
,
$BOT_NAME
);
// set webhook
echo
$telegram
->
setWebHook
(
'https://yourdomain/yourpath_to_hook.php'
);
$result
=
$telegram
->
setWebHook
(
$link
);
if
(
$result
->
isOk
())
{
echo
$result
->
getDescription
();
}
}
catch
(
Longman\TelegramBot\Exception\TelegramException
$e
)
{
echo
$e
->
getMessage
();
}
```
And open your
*set.php*
via browser.
...
...
example-set.php
View file @
c7438436
...
...
@@ -4,12 +4,15 @@ $loader = require __DIR__.'/vendor/autoload.php';
$API_KEY
=
'your_bot_api_key'
;
$BOT_NAME
=
'namebot'
;
$link
=
'https://yourdomain/yourpath_to_hook.php'
;
try
{
// create Telegram API object
$telegram
=
new
Longman\TelegramBot\Telegram
(
$API_KEY
,
$BOT_NAME
);
// set webhook
echo
$telegram
->
setWebHook
(
'https://yourdomain/yourpath_to_hook.php'
);
$result
=
$telegram
->
setWebHook
(
$link
);
if
(
$result
->
isOk
())
{
echo
$result
->
getDescription
();
}
}
catch
(
Longman\TelegramBot\Exception\TelegramException
$e
)
{
echo
$e
->
getMessage
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment