0

Below is my code in Python. My lecturer requested me is that possible to send the fanspeed.output['fan'] to PHP. For example, I created a webpage on xampp then I need to send the output of the python to the webpage which will display the output on the webpage. I searched online and I could not find a working way to solve it. Can anyone help, please?

temp = int(input("temp="))
hum = int(input("hum="))
fanspeed.input['temperature'] = temp
fanspeed.input['humidify'] = hum
fanspeed.compute()
fanspeed.output['fan']
fan.view(sim=fanspeed)
print("Fan speed =",fanspeed.output['fan'])
Sam
  • 19
  • 5
  • That's funny, I searched your question title in Google and got 10.8 million hits; 38000 of them from this site... – miken32 May 30 '21 at 18:32

1 Answers1

0

The easiest way is to call the python script via a shell_exec.

Something like this

<?php
echo shell_exec("python /path/to/your/python/script.py");
Andrea Olivato
  • 2,450
  • 1
  • 18
  • 30