1 year ago
#344500
trux
Control radio-controlled sockets with the Raspberrypi via a website with apache2
I want to control my radio-controlled sockets with the raspberry pi via a website with apache2. But nothing happens when I click on the buttons on the website. I also get no error. My code is:
<html>
<head>
<meta name="viewport" content="width=device-width"/>
<meta charset="UTF-8">
<title>DIY smart home</title>
</head>
<body>
<form method="post">
<input type="submit" value="LED desk on" name="led_desk_on">
</form>
<form method="post">
<input type="submit" value="LED desk off" name="led_desk_off">
</form>
</br>
<form method="post" >
<input type="submit" value="LED bed on" name="led_bed_on">
</form>
<form method="post" >
<input type="submit" value="LED bed off" name="led_bed_off">
</form>
<?php
if(isset($_POST['led_desk_on'])) {
exec("sudo /home/pi/steckdosen/raspberry-remote/./send 01010 1 1");
}
if(isset($_POST['led_desk_off'])) {
exec("sudo /home/pi/steckdosen/raspberry-remote/./send 01010 1 0");
}
if(isset($_POST['led_bed_on'])) {
exec("sudo /home/pi/steckdosen/raspberry-remote/./send 01010 2 1");
}
if(isset($_POST['led_bed_off'])) {
exec("sudo /home/pi/steckdosen/raspberry-remote/./send 01010 2 0");
?>
</body>
</html>
The website looks like this: website
When I click on the buttons nothing happens.
php
html
linux
raspberry-pi
apache2
0 Answers
Your Answer