-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonkyo.php
More file actions
30 lines (27 loc) · 764 Bytes
/
onkyo.php
File metadata and controls
30 lines (27 loc) · 764 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
<?php
$command = $_GET['command'];
$params = $_GET['params'];
$hostname = '10.0.0.14';
$port = 60128;
switch ($command)
{
case 'PWR':
case 'AMT':
case 'SLI':
case 'TUN':
$message = '!1' . $command . $params;
break;
case 'MVL':
if ($params > 60)
exit(1);
$message = '!1' . $command . strtoupper(str_pad(dechex($params), 2, '0', STR_PAD_LEFT));
break;
default:
exit(1);
}
print $message;
$fp = pfsockopen($hostname, $port);
$packet = "ISCP\x00\x00\x00\x10\x00\x00\x00" . chr(strlen($message) + 1) . "\x01\x00\x00\x00" . $message . "\x0D";
fwrite($fp, $packet);
fclose($fp);
?>