Neatware Header

Ladybug
StudioXP
Video Control

PlayerXP
MPEG,AVI,VCD

Snaml
Generic
XHTML,WML

C#
.NET,XML,ASP

Java
J2EE,XML,JSP

MyrmecoX
Professional
Tcl/Tk IDE

Enterprise
Server,Terminal


    CGI

  1. Introduction

    CGI (Common Gateway Interface) is a protocol that connects a web client to a web server. CGI program is a filter that gets input from a client, manipulate data on the server, and feedback result to the client. CGI turns a static web site into an interactive and dynamic web site. One CGI application accepts the HTML form data from a client and returns a HTML page. Another CGI application is gateway where CGI program forms a SQL query and generates user readable information retrived from a database. Finally, a CGI program is suitable to generate dynamic documents.

    CGI program runs on a web server. Usually it is located on a subdirectory called cgi-bin. When server receives a command such as "get /cgi-bin/default.cgi HTTP 1.0", the default.cgi program will start to run. HTTP 1.0 is a communication protocol. CGI program will receive its input from stdin or environment variables in an operating system. It will send outputs to stdout. By using redirection CGI may easily change the output target. Following is the a simple example hello.cgi of Snaml.

    #!/usr/local/bin/snaml specifies the location of snaml program.

    _cgi command specifies a list of CGI headers. The 'Content-type' header specifies the type of CGI's returning data.

    # hello.cgi program
    #!/usr/local/bin/snaml
    _cgi "Content-type: text/vnd.wap.wml"
    __pi {xml version='1.0'}
    __doctype {wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
               "http://www.wapforum.org/DTD/wml_1.1.xml"}
     
    _wml
      _card
        _p
          _q "Hello, I am Snaml CGI!"
        p_
      card_
    wml_
  2. Configuration

    To use WML services, you must configure your web server with the following MIME types and file extensions. For example, in Apache mime.types.default file, you should add lines with the formats for WML, WMLScriptics, and 1-bit bitmap,

    text/vnd.wap.wml             wml
    text/vnd.wap.wmlscript       wmls
    image/bmp                    bmp