");
return 0;
}
The output on the web browser will be —
It’s my First CGI Program!
Input with CGI usually (but not always) requires environment variables, which
can be obtained with a call to getenv() for each environment variable you want.
The list of various environmental variables is as shown below =
SERVER_SOFTWARE This holds the software name and
version of the server you are running on.
SERVER_NAME This holds the servers hostname, ONS alias, or
IP address.
SERVER_PROTOCOL _This holds the name and revision of the
information protocol this request came in with.
SERVER_PORT The port the server listens on for connections,
Usually 80
REQUEST_METHOD The method with which the request was made,
for the HTTP protocol, this is "GET", "HEAD", or
"POST".
PATH_INFO Scripts can be accessed as a virtual pathname,
followed by extra information at the end of this
path.
PATH_TRANSLATED The server provides a translated version of
PATH_INFO, which takes the path and does
any virtual to physical mapping to it. It is then
stored in this environment variable.
SCRIPT_NAME This is. a virtual path to any script being executed
QUERY_STRING Any information following a ? in the URL which
referred to this script.Web Technologies To8. Basic Web Concepts
REMOTE_HOST This holds the address of the remote host which
is the host of the person calling the script.
REMOTE_ADDR The IP address of the remote address making
‘the request.
AUTH_TYPE If the server supports authentication, and the
script is protected this is the protocol specific
method used to validate the user.
REMOTE_USER If the server supports authentication, and the
script is protected this is the usemame or User ID
CONTENT_TYPE For queries which have attached information such
as "HTTP" "POST" and “PUT”, this is the content
type off the data, usually it is text/plain.
CONTENT_LENGTH Size of the input given by the user
1.5 Introduction to SGML
‘The Standard Generalized Markup Language(SGML) is a language for defining the
markup languages. SGML is a descendant of IBM's Generalized Markup Language
(GML), developed in the 1960s by Charles Goldfarb, Edward Mosher and Raymond
Lorie.The angular brackets are used to define the tags in the SGML.
Applications of SGML
SGML was widly used to share the documents in large projects
It is used in printing and publishing industry.
Due to its complex nature it is rarely used for small and general purpose
applications.
One of the major applications of SGML is Oxford English Dictionary
(OED), which was and is created using an SGML-like markup.
Using SGML following things can be done -
Assemble a single document from many sources (such as SGML
fragments, word processor files, database queries, graphics, video clips,
and real-time data from sensing instruments)
Define a document structure using a special grammar called a Document
‘Type Definition (DTD)
Validate that the document follows the structure that has been defined in
the DTD.a esse
Difference between SGML and HTML
HTML is an SGML application. Most of the HTML browsers do not support some
basic SGML constructions but all the SGML authoring tools can produce HTML
documents
Review Questions
1. What do you mean by URL. Explain the various components of an URL.
What is MIME? Explain the purpose of MIME along with suitable examples?
What is CGI? Explain with some example
Enlist various environmental variables that are associated with CGI.
What are the applications of SGML? Differentiate between SGML and HTML.
Qo0