summaryrefslogtreecommitdiff
path: root/web/sendcmd.php
diff options
context:
space:
mode:
authordaniel-Jones <daniel@danieljon.es>2017-06-04 16:26:56 +0930
committerdaniel-Jones <daniel@danieljon.es>2017-06-04 16:26:56 +0930
commitf66536d84b38aa0eb46e928fdaf13d7da790b2ee (patch)
treeba2624354136f3f0db3ec929d1eea15635527ba1 /web/sendcmd.php
parent2ce2f6376152402c3fc0d750720770b963a7d3cf (diff)
downloadRGB-Controller-f66536d84b38aa0eb46e928fdaf13d7da790b2ee.tar.gz
RGB-Controller-f66536d84b38aa0eb46e928fdaf13d7da790b2ee.zip
added HTML/JS/PHP pages/scripts to allow RGB changes over a web page. Integrated a server into the application to allow incoming connections and receive commands
Diffstat (limited to 'web/sendcmd.php')
-rw-r--r--web/sendcmd.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/web/sendcmd.php b/web/sendcmd.php
new file mode 100644
index 0000000..80de312
--- /dev/null
+++ b/web/sendcmd.php
@@ -0,0 +1,23 @@
+<?php
+$host = "192.168.1.13";
+$port = 3001;
+$message = "red=" . $_GET['r'] . ";" . "green=" . $_GET['g'] . ";" . "blue=" . $_GET['b'];
+var_dump($_GET);
+//$message = "blue=0";
+//echo "Message To server :".$message;
+// create socket
+$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
+// connect to server
+$result = socket_connect($socket, $host, $port) or die("Could not connect to server\n");
+// get server response
+//Send the message to the server
+if( ! socket_send ( $socket , $message , strlen($message) , 0))
+{
+ $errorcode = socket_last_error();
+ $errormsg = socket_strerror($errorcode);
+ die("Could not send data: [$errorcode] $errormsg \n");
+ } else {
+ echo "Message send successfully \n".$message;
+ }
+ socket_close($socket);
+ ?>