Skip to content

Instantly share code, notes, and snippets.

@salvatorecordiano
Created May 28, 2017 17:29
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 salvatorecordiano/f42c36c2d757acb8fdb499eb0abcc352 to your computer and use it in GitHub Desktop.
Save salvatorecordiano/f42c36c2d757acb8fdb499eb0abcc352 to your computer and use it in GitHub Desktop.
<?php
$content = file_get_contents("php://input");
$update = json_decode($content, true);
if(! $update) {
exit;
}
$chatId = $update['message']['chat']['id'] ?? null;
$text = $update['message']['text'] ?? null;
if(! $chatId || ! $text) {
exit;
}
header("Content-Type: application/json");
echo json_encode(['chat_id' => $chatId, 'text' => $text, 'method' => 'sendMessage']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment