9D48D,0-<$ #<,-P<W4W
!35 , :;<
=005 03>>>0: <- ,-, -+ + )9 ")9,0 - , ;< : 0!+ <- ,2 +
;< !% +:F !%
/ #$ U J +;
: # J +$L J +;
.: # J +$L J 34+;
: # J +934$L J 34+;
.: # J +934$L V
(76
00- ,0 -,0- , - , ;< J < ;<<- ,3-( =, 0- !% +:F !%,03- ,-I , ;< < ;< : <0- , ;< < ;<
<+;< < %;<
/ #$<0-, 0-,0- ,-J : , ;< < ;< : < F;<7<0- , 0- : , ;< < ;< : < F;<7<0- , 0-J :34 : , ;< 34< ;< : < F;<7<0- , 0- :34 : , ;< 34< ;< : < F;<7<0-,0- ,0 - ,0 - ,0 -
!37 2'&&'&'%$>&''>%&'% , :;<
=005 03>>>0: <- ,- , - ) ,0 - , ;< : 0!+ <-
(7
,2 G
/ #$ U + ;J + #<<$L J +; ! #<]<$L J +; J + #H93H$L V 00- ,0 - ,0- , - , ;<J < ;<<- ,-I , 0- , ;< < ;< : < F;<6H<0- , ;< G
< ;<
<+; < < %;< G
/ #$<0-,0- ,-( , 0- , : ;< < ;
(7(
!3: !" , :;<
=005 03>>>0: <- ,- , -1'()) %) ! ,0 - , ;< : 0!+ <- ,2 + (: ;<( <9 %(: ;<( % : <9 :(: ;<( : <9 %(: ;<" % (: <9 %(: ;<( % : <9 (: ;< <9 (: ;<
(72
!5
G &, [ & F
@
[ F " ' , [ + " ( #("$; N )( #N)($ & F + ?'
, :;<
=005 03>>>0: <- ,-, -? ( ) ,0 - , ;< : 0!+ <- ,2 + ;? #$L #<,3- + ,03-<$L
(77
#< =<W #$W <, 0- =<W #$W <, 0- (" =<W (" #$W <, 0-+ =<W + #$$L #<,3-N F,03-<$L #< ? =<W ? #$W <, 0- ?=<W ?#$W <, 0- ) =<W ) #$W <, 0- J@ =<W J@ #$W <, 0- ( =<W ( #$W <, 0- ' =<W ' #$W <, 0- ) =<W ) #$W <, 0- =<W #$W <, 0- ) =<W ) #$W <, 0- ( F
=<W ( F
#$$L #<,3- ? ,03-<$L + ? ;? #4HH39493D93979H9H$L #$L ? #7>$L #<) =<W ? $L 00- ,0 -,0-, -,0 -,0 -
(78
!7
G &, , * F F
> &0?%
'
" &, # &, ## F &,
## F 1 >J-##) *M ' ## F & ?% )
?% A
1> $KK% ## F ?%9 ## F &
(7:
C
9 "
G $G % D >
" " " 'C " " [ ) 1 " G $ %1 D>,
.
" D>,
D>, [
&,
' F + V
: \
(7<
' D>,
- $ !@% 9 $ 9.% * $ % " $ % 7 $1 9.% 12 $ # %
$
3
" D>, ;+ ;
$
% D
(75
' 1 (88
$6^A%
D D>, ' 9 1)
D>, 1 &, , D>, $ $? ##2%d [ ; $ XY &, % ' ?00 $ ? ?00 %0 $ ? &, D>, [
?00 %0 $ ? 1 &, [
1 "0
(7A
$ L,+ 8+
$ 8+ M L,+ M "
$ 8+ M L,+ M + $
$ 8+ M L,+ M & %
(86
$ 8+ M : L,+ M & :%
$ 8+ M L,+ M /
5
9 " D>, " 1
+ ) % 12&/ + D>, ' / ; eΠ03DH
(8
4 /
(8(
L,+
7
9 " = " "
- . L,+ , :;<
=005 03>>>0: <- ,- , - G ,0 - , ;< : 0+ <- ,2 I: ? ( Ab" %#$ ? ;. G:#b
(82
, 0- , ;<<- , ;<A< ;<
< +;<" %' A ( <0- ,0 - ,0 - ,0 -
(87
& . , :;<
=005 03>>>0: <- ,-, - ,0 -,0- , - , 0- , ;<<- , ;< < F;<3<- , +;<
=00 <- ? KA 9. ,0 - , +;<
=00 <- / ' ,0 - , +;<
=00 0 +<- / '. + ,0 - ,0 - ,2G - , ;< <+ ;<< ;< : 0+ <- ,2 ? ;? J #H$ - ,0 -,0 -,0 -,0 -
(88
# ,- , - G / ,0 - , ;< : 0+ <- ,2 I: PJ +A + P J ) # 99 $ . , ( ; I. . , ( ; I. ) ; P + IJ I+#$ . )4;H( ")G:#K< +<$ I ")G:#K< <$ I. I G
b" %#$ ? 39 49 59 P"+ 3;"#? J #H$ : G:3$ 4;"#? J #H$ : G:4$ 5;"#? J #H$ : G:5$ ;) # 39 49 5$ "I+# $ I - ,0 - ,0- , - , ;<<-I , ;< : <;< : G:3< F;<7< +;
(8:
,-I , ;< : <;< : G:4< F;<7< +;
<;<G
< +;
:
A
: F [ + 1 4 [ + 1
$ \ ]
% )
)* '
+ ' : 1 6 (7<752:75$
%
(8<
' '11>%).*
1>% ' . $ 1% 1>% ' $ 1% 1>% A " 1 +
D>, # 4
" d ">'( 1 # 'C , :;<
=005 03>>>0: <- ,- , - G A ,0 - , ;< : 0+ <- ,2 I: / ? A #:9$ ? ! ? * #K<=<$ J !;H(G#:$ ? * #:#!$K<<$ : ? * #<, 0-<$ I ? : F#5$9 :A 9 #$9% ? #5$P? F :A ;A #
(85
P F 9 + + ? / + #7$ #5$;5565 #6$;MM5M665 "? A # 9b <
? / +<$ - ,0 - ,0-, -,0 - ,0 -
3 1 & ! - NN O E! >
&'2 /
3 #$ #$
" #$ #$
D
"
(8A
, :;<
=005 03>>>0: <- ,- , - G J ,0 - , ;< : 0+ <- ,2 I: / J ( (/ # / $ ? P + ? %9
: PN P ; # / $ J %;H G# $ P"%
+ . . #39< <9b "#
# #%$93$$$(
:;<< I
:;<<
(:6
I. P"+ #%$; # #%$9b # #%$$3$Kb
# #%$93$K
: : P 9 P ( (/ ;E # $ IJ G
b" %#$ ? ;? J #H$ : . ? #H$ : / ;b ( (/ # $ I - ,0 - ,0- , - , ;<<-I , ;< : <;< : . < F;<7H<0- ,-/ , ;< : <;< : / < F;
<;<G
< +;<( <0-,0- ,0 - ,0 - ,0 -
(:
B
G 9F $ % $
%
$ + %L F 9F ' F F F ; F ) D>, F $
F $ % ) D>,
\ ]
D>,
'
+ & + 9
!
$
%
' 1 % ' " $
%" $
% , 9 $.J% ; $ %
$ % ,2G "- , :;<
=005 03>>>0: <- ,- , - G ",0 - , ;< : 0+ <- ,2 I: "/ / + 9 9
(:(
/ / J # $ ; I/ / / N J #$ J ; I/ / / A#$ ; I/ / / N A#$ A; I/ / / #$ . #$( ; I ;
;
b" %#$ ? P? !
(:2
;/ P. / ! * J ;? J #H$ : G:3 A;". #? J #H$ : G:4$ ;b ? J #H$ : G:5 ")G:#( #$$ I* I - ,0 - ,0- , - , ;<<-I , ;< : <;< : G:3< F;<3H<0- ,-I , ;< : <;< : G:4< F;<7<0-,0- ,-I , ;< : <;< : G:5< F;<3H<0- ,0-,- , ;<
<;<G
< +;
(:7
C
" "
GGG1*&GGG
(:8
UNIT 2: COMMON GATEWAY INTERFACE
WEB TECHNOLOGY
UNIT – II COMMON GATEWAY INTERFACE 2.1
COMMON GATEWAY INTERFACE (CGI) When you are dealing with Web pages, you will often hear people talk about CGI
or CGI scripts without ever explaining exactly what that is. Essentially, CGI is the connection (or interface) between a form on a Web page and the Web server. Web pages cannot interact directly with the reader. In fact, until JavaScript came along, Web pages had no way of interpreting reader reaction except through interaction with the server they were running on. This interaction is done through scripts and programs that use common gateway interface to create interactive programs on your Web pages. If you are creating a Web site and want a CGI application to get control, you specify the name of the application in the uniform resource locator (URL) that you code in an HTML file. This URL can be specified as part of the FORMS tags if you are creating a form. For example, you might code: An XHTML Form That Passes Your Name to a CGI Program
After looking at a few CGI programs, you’re ready to learn more about how they access information from the browser. Before the server launches the script, it prepares several environment variables representing the current state of the server that is invoking the script.
Thangavel Murugan
2.7
UNIT 2: COMMON GATEWAY INTERFACE
WEB TECHNOLOGY
The environment variables given to a script are exactly like normal environment variables, except that you can’t set them from the command line. They’re created onthe-fly and last only until that particular script is finished. Each script gets its own unique set of variables. In fact, a busy server often has many scripts executing at once, each with its own environment.
A CGI script picks up the environment variables and reads STDIN as appropriate. It then does whatever it was designed to do and writes its output to STDOUT.
The MIME codes that the server sends to the browser let the browser know what kind of file is about to come across the network. Because this information always precedes the file itself, it’s usually called a header. The server can’t send a header for information generated on-the fly by a script because the script could send audio, graphics, plain text, XHTML, or any one of hundreds of other types. Therefore, the script is responsible for sending the header.
The broad steps of the CGI process, simplified for clarity: 1) Your browser shows the XHTML document containing a form. 2) You enter data into the form as needed and then click the Submit button. 3) Optionally, a client-side script validates what you entered and only submits the data if it’s in an appropriate format. 4) The browser decodes the URL from the