-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathsend.php
More file actions
36 lines (30 loc) · 773 Bytes
/
send.php
File metadata and controls
36 lines (30 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/*
* Telegram Bot Sample
* ===================
* UWiClab, University of Urbino
* ===================
* Basic message sending script for your bot.
* Start editing here. =)
*/
include ('lib.php');
// Put the chat identifier here in order to send messages from your bot
define('CHAT_ID', 123456789);
if(count($argv) < 2) {
echo ('Must pass message to send as command line parameter.' . PHP_EOL);
exit;
}
$message = $argv[1];
echo "Message is '$message'." . PHP_EOL;
echo ('Executing request...' . PHP_EOL);
$response = telegram_send_message(CHAT_ID, $message, array (
'disable_web_page_preview' => true
));
if($response === false) {
echo ("Request failed." . PHP_EOL);
}
else {
echo ("Response:" . PHP_EOL);
print_r($response);
}
?>