summaryrefslogtreecommitdiff
path: root/web/sendcmd.php
diff options
context:
space:
mode:
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);
+ ?>