Skip to content

Instantly share code, notes, and snippets.

@kenniki
kenniki / gist:34706d895ed6adc90909
Last active August 29, 2015 14:24
Telegram Bot API: Repeat text w/ Webhook
<?php
$botkey = "PUT BOT KEY HERE";
/*--------------------------------------------------------------*/
$input = file_get_contents("php://input"); // Retrieve information sent by webhook
$sJ = json_decode($input, true); // decode JSON supplied by webhook to PHP array
$ch = curl_init("https://api.telegram.org/bot" . $botkey . "/sendMessage");
<?php
class connector {
private $process;
private $pipes;
private $core;
public function __construct($core) {
$this->core = $core;
$cmd = "/opt/tg-bin/telegram-cli --json -k /opt/tg-bin/server.pub --disable-link-preview -I -R -C -N";