Is there a way to run python script for html webpage? it's very important. i have a python script works fine in my raspberry Pi but i want to work with my home page,
how can i do that?
Is there a way to run python script for html webpage? it's very important. i have a python script works fine in my raspberry Pi but i want to work with my home page,
how can i do that?
Please i want to know what's wrong in this html code to execute my python script via internet.
<html>
<head>
<?php
if (isset($_POST['LightON']))
{
exec("sudo python /var/www/lighton.py");
}
if (isset($_POST['LightOFF']))
{
exec("sudo python /var/www/lightoff.py");
}
?>
<form method="post">
<button class="btn" name="LightON">Light ON</button>
<button class="btn" name="LightOFF">Light OFF</button><br><br>
<br><br><br><br>
</form>
</html>
<?php
if (isset($_POST['LightON']))
{
exec("sudo python /var/www/lighton.py");
}
if (isset($_POST['LightOFF']))
{
exec("sudo python /var/www/lightoff.py");
}
?>
This has several issues:
If you want a simpler way to control the light take a look at REST API in http://lmgtfy.com/?q=raspberry+pi+rest+server
Thank you very much, i do have the python code, on my pi, i really do not care much about the security now, but i want to find a way to be able to control these 2 python code over the internet or intranet.
if you could please help me out i would appreciated
i forget to tell you that i do have Apache2 running with wordpress
i forget to tell you that i do have Apache2 running with wordpress
Did you ever got to solve this??