Created
June 5, 2016 18:51
-
-
Save u-mulder/a27c556045a522e30834fe845510ebbf to your computer and use it in GitHub Desktop.
Send setWebhook to TelegramBot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('BOT_TOKEN', 'YOUR_BOT_TOKEN_HERE'); | |
$wh_url = 'YOUR_WEB_HOOK_URL'; // must support https! | |
$url = 'https://api.telegram.org/bot' . BOT_TOKEN . '/setWebhook?' . http_build_query(['url' => $wh_url]); | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$r = curl_exec($ch); | |
curl_close($ch); | |
var_dump($r); | |
// If webhook was set - response is: | |
// "{"ok":true,"result":true,"description":"Webhook was set"}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment