tags:

views:

274

answers:

5

I am just wondering how a web site posts information to an exe and how that exe grabs that information and outputs it using a template html file.

The code on the web side looks something like this:

<FORM ACTION="scripts/fetch.exe" METHOD=POST NAME=somename> 
<INPUT TYPE=TEXT NAME="id" WIDTH=30>
<INPUT TYPE=SUBMIT NAME="nothing" VALUE="Submit">
</FORM>

How does the exe file then get that "id"?

Edit: to be a little more specific:

after that exe (which i have the source to if needed) is called it looks up the user in a directory based on that id, then prints out the users information based on a template file. i know what it does with the information, i just dont really understand how it gets that information.

A: 

Why are you so sure that the exe is actually a .exe application? You can map file extensions to anything you like. I actually like to disguise my PHP pages as JSP.

Tom Ritter
Why bother? Better yet would be to rewrite your URLs to hide implementation altogether, in the vein of Tim Berners-Lee's suggestion that "cool URIs don't change".
Rob
No reason really. Just to confuse my friends.
Tom Ritter
A: 

Web servers usually pass such requests to external handlers via the Common Gateway Interface.

Rob
A: 

If you have an executable that you need to execute from the form, try to set up a web script that will grab the parameter and execute the command for you instead of posting directly to the .exe.

Tomas Lycken
+2  A: 

This form uses CGI

In a nutshell, Most CGI programs have a library included that helps the programmer easily access form parameters. At that point, the program can process the data in a number of ways (database lookups, calculations, etc), and generate content (html, javascript, etc) to return the page. CGI was common before web servers were well integrated with application servers and interpreters like they are now.

Without the source (or disassembly) of that executable, you can not know the details of what it is doing.

Tim Hoolihan
+1  A: 

This is a CGI application. When run, the web server will execute the program and provide data through environment variables and STDIN.

In this example, the POST form is read from STDIN in the form of

id=30&nothing=Submit
spoulson
thanks, that just made it all make sense
Petey B