Untitled

 avatar
unknown
plain_text
2 years ago
805 B
3
Indexable
<?php
ini_set ('display_errors', true);
$content = file_get_contents("php://input");


file_put_contents ('log.txt', $content);


$update = json_decode($content,true);

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



// Change response (Text) here:

if ($text == 'salam'){
    $text = 'Salam chetori?';
}else if ($text == 'bye'){
    $text = 'Khodafez ):';
}else{
    $text = 'Chi migi?' . PHP_EOL . 'chimigi to chiye?' . PHP_EOL . $text;
}





$text = urlencode ($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);
Editor is loading...