This file contains hidden or 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 | |
class Telegram { | |
const API_ROOT = "https://api.telegram.org/bot%KEY%/%METHOD%"; | |
private $botkey; | |
private $methods = [ | |
"getUpdates" => [ | |
"meta" => [ | |
"type" => "POST" | |
], |
This file contains hidden or 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 | |
$chat = json_decode(file_get_contents("php://input"))->message->chat->id; | |
header("Content-Type: application/json"); | |
echo json_encode(array("method" => "sendMessage", "text" => "Hello World", "chat_id" => $chat)); |
This file contains hidden or 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 | |
/* wit.ai speech recognition in PHP */ | |
$request = curl_init('https://api.wit.ai/speech'); | |
$headers[] = 'Authorization: Bearer YOURAPIKEY'; | |
$headers[] = 'Content-Type: audio/wav'; | |
curl_setopt($request, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($request, CURLOPT_POSTFIELDS, file_get_contents("soundfile.wav")); | |
curl_setopt($request, CURLOPT_HTTPHEADER, $headers); |
This file contains hidden or 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 | |
/** | |
* FileServe | |
* | |
* Class that serves a file from disk to a client. | |
* | |
* @package FileServe | |
* @author Kenny <[email protected]> | |
* @license The Unlicense (http://unlicense.org) | |
*/ |
NewerOlder