Jump to content

Raspberry pi web control

First off I don't think you can do that with an .html file. You would need a .php one or atleast a javascript in the html that then calls the python script. Don't quote me though since I personally have trouble with these things haha, but I think that is how you need to start.

FX-8350 GTX760 16GB RAM 250GB SSD + 1TB HDD

 

"How many roads must a man walk down?" "42"

Link to comment
https://linustechtips.com/topic/449083-raspberry-pi-web-control/#findComment-6021415
Share on other sites

Link to post
Share on other sites

First off I don't think you can do that with an .html file. You would need a .php one or atleast a javascript in the html that then calls the python script. Don't quote me though since I personally have trouble with these things haha, but I think that is how you need to start.

well, at least thanks for the reply, and i tried ajax, but that didn't work...
Link to comment
https://linustechtips.com/topic/449083-raspberry-pi-web-control/#findComment-6021445
Share on other sites

Link to post
Share on other sites

well, at least thanks for the reply, and i tried ajax, but that didn't work...

How does the code look like? I could try to help you, can't garantue I will solve it though

FX-8350 GTX760 16GB RAM 250GB SSD + 1TB HDD

 

"How many roads must a man walk down?" "42"

Link to comment
https://linustechtips.com/topic/449083-raspberry-pi-web-control/#findComment-6021456
Share on other sites

Link to post
Share on other sites

I threw it in the garbage, but if you type in tinkernut in YouTube you'll probably find the video that I followed...

Well you could have tried to do this in php. It should run the python file, if I'm right

<html><body><?exec ("helloworld.py");?></body></html>

FX-8350 GTX760 16GB RAM 250GB SSD + 1TB HDD

 

"How many roads must a man walk down?" "42"

Link to comment
https://linustechtips.com/topic/449083-raspberry-pi-web-control/#findComment-6021468
Share on other sites

Link to post
Share on other sites

I don't have my pi on hand, but I'll try

Yeah I could have tried if I had any python scripts hah. My pi should be running a apache server with all plugins and such.

FX-8350 GTX760 16GB RAM 250GB SSD + 1TB HDD

 

"How many roads must a man walk down?" "42"

Link to comment
https://linustechtips.com/topic/449083-raspberry-pi-web-control/#findComment-6021474
Share on other sites

Link to post
Share on other sites

I don't have my pi on hand, but I'll try, and how do I make it on a button press?

Have an invisible iframe on the page, and when the button is pressed, it could use JavaScript to change the iframe location to the PHP page which then runs the python script.

Speedtests

WiFi - 7ms, 22Mb down, 10Mb up

Ethernet - 6ms, 47.5Mb down, 9.7Mb up

 

Rigs

Spoiler

 Type            Desktop

 OS              Windows 10 Pro

 CPU             i5-4430S

 RAM             8GB CORSAIR XMS3 (2x4gb)

 Cooler          LC Power LC-CC-97 65W

 Motherboard     ASUS H81M-PLUS

 GPU             GeForce GTX 1060

 Storage         120GB Sandisk SSD (boot), 750GB Seagate 2.5" (storage), 500GB Seagate 2.5" SSHD (cache)

 

Spoiler

Type            Server

OS              Ubuntu 14.04 LTS

CPU             Core 2 Duo E6320

RAM             2GB Non-ECC

Motherboard     ASUS P5VD2-MX SE

Storage         RAID 1: 250GB WD Blue and Seagate Barracuda

Uses            Webserver, NAS, Mediaserver, Database Server

 

Quotes of Fame

On 8/27/2015 at 10:09 AM, Drixen said:

Linus is light years ahead a lot of other YouTubers, he isn't just an average YouTuber.. he's legitimately, legit.

On 10/11/2015 at 11:36 AM, Geralt said:

When something is worth doing, it's worth overdoing.

On 6/22/2016 at 10:05 AM, trag1c said:

It's completely blown out of proportion. Also if you're the least bit worried about data gathering then you should go live in a cave a 1000Km from the nearest establishment simply because every device and every entity gathers information these days. In the current era privacy is just fallacy and nothing more.

 

Link to comment
https://linustechtips.com/topic/449083-raspberry-pi-web-control/#findComment-6021909
Share on other sites

Link to post
Share on other sites

about plugins, will I need any for this?

You will need it enabled for php, but really if you have a web server everything important should be included

FX-8350 GTX760 16GB RAM 250GB SSD + 1TB HDD

 

"How many roads must a man walk down?" "42"

Link to comment
https://linustechtips.com/topic/449083-raspberry-pi-web-control/#findComment-6022229
Share on other sites

Link to post
Share on other sites

Why not write a service that responds to GET requests with python in the first place? Then send ajax requests and do whatever, if you can't get direct requests to client, then do the requests from php. I remember I did that once to circumvent CORS and put an external api functions into my web page.

Link to comment
https://linustechtips.com/topic/449083-raspberry-pi-web-control/#findComment-6025100
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×