How it Works
To produce a program that can be called from a web server is fairly easy. Below is a standard web version of a "Hello World" program that is written in SIMPOL:
function main(cgicall cgi) string s s = "Content-type: text/HTML{d}{a}{d}{a}" s = s + "<html><body>Hello World!</body></html>" end function s
This program might be saved as cgihello.sma
. When compiled the program would normally
be called cgihello.smp
. To get the Apache web server to run this program it would have
to be prefaced by what is known as a shebang line. This is a convention that originated
on Unix. It is formatted in such a way that it is normally considered a comment in shell scripts but this
one has a special format and is interpreted to determine which program should be used to execute the remainder
of the script. In the case of a web server program this line is retrieved by the web server and used to find
out what program should be used to execute that script. For a Windows-based program, the shebang line might
look like this:
#!C:\Program Files\SIMPOL\bin\smpcgi32.exe{d}{a}
The SIMPOL IDE is especially designed to make building these types of programs quite easy. Simply go into
the dialog called from the httpd.conf
file the line: Add-Handler cgi-script .smp
would need
to be added and if running, Apache would need to be restarted. This program is already available on the Superbase
web site: SIMPOL Hello World Sample.