Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
503 B
2
Indexable
Never
<?php
ini_set ('display_errors', true);
$content = file_get_contents("php://input");

$update = json_decode($content,true);

$chat_id = $update["message"]['chat']['id'];
$text = $update["message"]['text'];

$url = 'https://api.telegram.org/bot5724544375:AAHZaxveJswoa48N3nELNuo2XHclJx4TsTY/sendMessage?chat_id=' . $chat_id . '&text=' . $text;
// CURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); # for return $url results
$result = curl_exec($ch);