-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver_message.php
More file actions
executable file
·34 lines (28 loc) · 1.05 KB
/
server_message.php
File metadata and controls
executable file
·34 lines (28 loc) · 1.05 KB
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
<?php
// load framework files
require_once("/opt/ts3php/libraries/TeamSpeak3/TeamSpeak3.php");
// load config file
require_once(".config.php");
try
{
$server = $argv[1];
$instance = $argv[2];
$msg= $argv[3];
$user = "user_" . $server . "-" . $instance;
$pass = "pass_" . $server . "-" . $instance;
$host = "host_" . $server;
$query = "query_" . $server;
$voice = "voice_" . $server . "-" . $instance;
// IPv4 connection URI
$uri = "serverquery://" . $cfg[ $user ] . ":" . $cfg[ $pass ] . "@" . $cfg[ $host ] . ":" . $cfg[ $query ] . "/?server_port=" . $cfg[ $voice ] . "";
// connect to above specified server, authenticate and spawn an object for the virtual server
$ts3_VirtualServer = TeamSpeak3::factory($uri);
// do the thing
$ts3_VirtualServer->execute("sendtextmessage", array("msg" => $msg, "target" => $ts3_VirtualServer->getId(), "targetmode" => TeamSpeak3::TEXTMSG_SERVER));
}
catch(TeamSpeak3_Exception $e)
{
// print the error message returned by the server
echo "Error " . $e->getCode() . ": " . $e->getMessage();
}
?>