AbidingDude
Programmer
So I'm trying to teach myself CGI programming. (I'm trying to do it in C because I know the language fairly well as opposed to other scripting languages which I do not.) I was trying to go through a tutorial:
I want to process simple form data (an idea I want to eventually implement at work). I've been trying to do all this from my hard drive. I have the executable in my compiler folder and the HTML file in another folder.
From what I gathered, I'll need to be able to process the "QUERY_STRING" variable, but it never seems to get set up properly. I try checking it with getenv("QUERY_STRING") but it always comes up NULL.
The example file I've been practicing with has the following segment for the FORM element:
<FORM METHOD="POST" ACTION="/cgi-bin/usr-inf">
Given that I was working on this in Windows, I changed it to:
<FORM METHOD="POST" ACTION="FILE://C:\<my_compiler_path>/hello.exe">
but Firefox keeps asking me where I want to save the file instead of running it. Understandable for security reason but still... (I originally had it as HTTP instead of FILE, but I kept getting "server not found" errors.)
The same things happens when I copied, pasted, and recompiled these files to my Ubuntu netbook.
The "hello.exe" is simply the "Hello" program from the tutorial page.
How can you simulate client/server interaction on a PC? I'm also surprised that CGI output is supposed to be written to standard-out, so of course I see the output in a command prompt window instead of a browser.
I want to process simple form data (an idea I want to eventually implement at work). I've been trying to do all this from my hard drive. I have the executable in my compiler folder and the HTML file in another folder.
From what I gathered, I'll need to be able to process the "QUERY_STRING" variable, but it never seems to get set up properly. I try checking it with getenv("QUERY_STRING") but it always comes up NULL.
The example file I've been practicing with has the following segment for the FORM element:
<FORM METHOD="POST" ACTION="/cgi-bin/usr-inf">
Given that I was working on this in Windows, I changed it to:
<FORM METHOD="POST" ACTION="FILE://C:\<my_compiler_path>/hello.exe">
but Firefox keeps asking me where I want to save the file instead of running it. Understandable for security reason but still... (I originally had it as HTTP instead of FILE, but I kept getting "server not found" errors.)
The same things happens when I copied, pasted, and recompiled these files to my Ubuntu netbook.
The "hello.exe" is simply the "Hello" program from the tutorial page.
How can you simulate client/server interaction on a PC? I'm also surprised that CGI output is supposed to be written to standard-out, so of course I see the output in a command prompt window instead of a browser.