Skip to content

Instantly share code, notes, and snippets.

@u-mulder
Created June 5, 2016 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save u-mulder/a27c556045a522e30834fe845510ebbf to your computer and use it in GitHub Desktop.
Save u-mulder/a27c556045a522e30834fe845510ebbf to your computer and use it in GitHub Desktop.
Send setWebhook to TelegramBot
<?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