tg-bot-api /
bot-api-base
| 1 | <?php |
||
| 2 | |||
| 3 | $token = 1891640704:AAF3ZxfPZ7xPmAZEtc1UXKC-Lkf_cw2H4Es; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 4 | $website = 'https://api.telegram.org/bot'.$token; |
||
| 5 | $update = file_get_contents('php://input'); |
||
| 6 | $update = json_decode($update, TRUE); |
||
| 7 | $message = $update['message']['text']; |
||
| 8 | $id = $update['message']['from']['id']; |
||
| 9 | $name = $update['message']['from']['first_name']; |
||
| 10 | $surname = $update['message']['from']['last_name']; |
||
| 11 | $username = $update['message']['from']['username']; |
||
| 12 | |||
| 13 | sendMessage($id, "ciao, come va? "); |
||
| 14 | |||
| 15 | sendMessage($id, $text){ |
||
| 16 | $url = $GLOBALS[website]."/sendMessage?chat_id=$id&text=".urlencode($text); |
||
| 17 | file_get_contents($url); |
||
| 18 | } |
||
| 19 | |||
| 20 | ?> |
||
| 21 |