Form processing with cgi and uclinux
Hi, I read tutorials on cgi.... cant find that much help. I have a question.
I am working with a dragonball mc68k processor running uClinux. I will be installing the BOA webserver on this board. The board will control some lights. Either lights on or lights off. Now I want to put control in a web site so I can connect to the web site anywhere and turn on my house lights via web page. I have the C program written that will control the lights. I want to do the following very simple form. Code:
<FORM ACTION="URL"> So when some one selects lights on, it will execute a cgi script that will call a c program that turns on a light.( the web server will be hosted on a NETdimm processor, the processor is connected to a light and the c program controls the light(on/off). I want to implement this in a web site, so when a user goes to the web site they use the form on the website and select on or off in the form for lights. So Do I write a shell script that calls the C program? or a shell script that calls a cgi script which inturn calls my C lights program Code:
#!/bin/sh any guidance will be helpfull |
Here's an example perl script which handles both the job of printing the web page and running the lightsprogram. I make the assumption that your program is called lightsprogram and accepts -state, -on, and -off switches. I assume the -state switch prints "on" or "off".
This can of course be done through a shell script but perl has the nice CGI library, and I know it better.. hopefully this example is reasonably transparent anyway. You would put this script in your cgi-bin directory and chmod +x it. Code:
#!/usr/bin/perl |
Hey thanks for the help, nice job on the script but I cant use perl scripts(sorry), boa doesnt support it, I have to use either unix shell scripts or C programming scripts.
I dont need the results sent back to the web page, all I need is the user imput to activate or call my C program. C lights program GridX |
All times are GMT -5. The time now is 12:58 AM. |