-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.php
33 lines (25 loc) · 797 Bytes
/
run.php
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
<?php
#include("socket.php");
$RaspberryPiIP = '192.168.1.XXX'; // Change by your RaspberryPi/PC IP
$RaspberryPiPORT = 5000; // Change by your RaspberryPi / PC Port Number ..
$connection = new Socket(RaspberryPiIP,$RaspberryPiPORT); // Create a new socet Connection object.
$connection->init();
//////// Get Command from front end page
$on = "on";
$off = "off";
$data = "";
$operation = $_GET["op"];
if ($operation =="on")
{
$command = $on;
}
if ($operation =="off")
{
$command = $off;
}
//// end Get Command from front end page
$connection->open_socket(); // Connect PHP to RaspberryPi or computer.
$connection->send_data($command); //Send command String
$connection->close_socket(); //////////Close connection
///////////// DONE :) ///////////////
?>