Re: EuCGI test
- Posted by Daniel Berstein <daber at PAIR.COM> Feb 28, 1999
- 465 views
At 04:00 PM 28-02-1999 , you wrote: >Thank yuo...I can never say how happy i am at this...I have not messed >with it yet but is there a way to make it run any E code? I do not know >cgi(does anyone know of a good book or web site to start at?) > >Grape Vine I noticed you visited me on 2-28 16:49:48 4.20.104.15 as Grape Vine ;) On an earlier post is the full source code of the cgi you used. CGI programming is easy! A CGI is a program that takes an input, process it and then send it back to the webserver. The procesing of the data is done as usual, you can use anything you want, including calling other applications, connecting to databases, creating files, etc. The only special mention is about getting the input and sending output. There a mainly two way your CGI can get it's input: a) Reading the standard input (like when using the '<' in DOS). Here you must parse each query string that is in the form KEY1=VALUE?KEY2=VALUE2.. etc. Spaces are changed by the '+' sign. This way is the standard CGI (Unix) b) Some server support another way, called WinCGI. WinCGI was developed by O'Reilly for their WebSite webserver. Today several wintel webserver support WinCGI. WinCGI is mich simpler than std. CGI. The webserver creates an enviormental variable where a .INI file is specified. Your app then reads the KY=VALUE pairs from that standard Windows ini file. The task is simplifies because there are WinAPI functions that easily read a given key value. Each server may have it's own "other" way to pass parameters. In the case of Xitami the KEY/VALUE pairs are set as enviormental variables and alternativly as an input file (referenced by the CGI_STDIN enviomental variable). A CGI should output to the standard output. Because several languages can't do this under Windows (mainly VB), many wintel webserver pass the app. a filename it should use for it's output. Xitami defines this filename in the CGI_STDOUT enviormental variable. When sending your output to stdout the firs line must be exactly: Content-type: text/html followed by at least one blank line. After that you can send your html code. I can't suggest any CGI book because I don't have any (well I have an online version of "CGI programming on the WWW"), and haven't buy any because they are usually based on Perl, something that I just don't want to learn. Some useful (related) links: CGI official specification http://hoohoo.ncsa.uiuc.edu/cgi/interface.html CGI resources http://www.cgi-resources.com/ Yahoo's CGI directory ommon_Gateway_Interface/ Xitami http://www.xitami.net Internet Servers http://serverwatch.internet.com/ Regards, Daniel Berstein [daber at pair.com]