Page Personnelle de Vincent Kerhoas Vincent Kerhoas - Professeur Agrégé

Dynamic HTTP Server

Back                  << Index >>

A few illustrated reminds about simple dynamic http server.
For complete explanations, please have a look at : https://www.enib.fr/~harrouet


Getting server script results in a web browser client

REM : think about making the CGI file executable (chmod +x).



SOURCE CODE

dynamic_http_server_1

dynamic_http_server_2

dynamic_http_server_3


Application : Controlling RPI Led from the web browser



SOURCE CODE

Configuring GPIO4 LED

led RPI

Here we are in the RPI Terminal.
The following lines should be written in a bash script and recorded in /etc/profile.d to be executed on RPI startup.

Once config done, try :

Control GPIO4 with CGI script

dynamic_http_server_1

dynamic_http_server_2

dynamic_http_server_3

The executed script is a bash one ; another example can be done with a lua script ( in www/cgi )

Control GPIO4 led with AJAX

Previously we were obliged to download the whole page.
The ajax-way permits to refresh only a part of this page after a client request.

dynamic_http_server_1


Back                  << Index >>