To rule out some parts:
1. The php works ok for a Python command - controlling the Pi Face interface
2. The command lines work
I know a lot of you might be thinking why not use the Telldus Centre but I want to build this all from scratch as a learning curve.
The code below is my index.php file
Code: Select all
<?php
?>
<html>
<head>
<?php
if (isset($_POST['RedON']))
{
exec("python /var/www/pifaceon.py");
}
if (isset($_POST['RedOFF']))
{
exec("python /var/www/pifaceoff.py");
}
if (isset($_POST['plugon']))
{
exec("tdtool -n 1");
}
if (isset($_POST['plugoff']))
{
exec("tdtool -f 1");
}
?>
<title>Turn the lights on</title>
</head>
<body>
<form method="post">
<table
style="width: 75%; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="2" cellspacing="2">
<body>
<tr>
<td style="text-align: center;">Turn Lamp On</td>
<td style="text-align: center;">Turn Lamp Off</td>
<td style="text-align: center;">Turn Plug1 On</td>
<td style="text-align: center;">Turn Plug1 Off</td>
</tr>
<tr>
<td style="text-align: center;"><button name="RedON">Lamp On</button></td>
<td style="text-align: center;"><button name="RedOFF">Lamp Off</button></td>
<td style="text-align: center;"><button name="plugon">Plug On</button></td>
<td style="text-align: center;"><button name="plugoff">Plug Off</button></td>
</tr>
</body>
</table>
</form>
<p>
Hello there!
<?
?>
</p>
</body>
</html>
All the best
Gavin