PHP: CGI |
CGI (Common Gateway Interface — ) , Web- Web-. , Web- CGI-. . CGI Web-, CGI- .
, http://www.server.com/path/pict.gif
http- GIF (, ). , . ? , pict.gif . ? , CGI. - pict.gif /path/ , web- () . -, pict.gif CGI- " ", GIF. CGI. , , - . html-, .
. , , , CGI. CGI , . , CGI, — - , - (, PHP Perl ).
, , " ".
, , - . , — , , . (), , ! . , , , . , , ( - , )? , - , , ( , , ). CGI.
, - URL ? URL (http) web-. HTTP-, , /path/somefile.html. , somefile.html, . (). , web- , somefile.html , HTML-. , somefile.html (html), html-. , .
CGI
CGI , web-, . , web- , . CGI- , , - . , - , . CGI- IP- , , html- !
CGI web-, , , . - . CGI-, - . , , Content-type: image/gif. CGI- , - . , name=Ivan&email=ivan@ivanov.com cgi.exe. cgi.exe : cgi.exe name=Ivan&email=ivan@ivanov.com.
&. - , ""? ,
. , : , ... , , . PHP .
, ( URL) GET. , (, ), GET. , — POST. .
CGI, . , . .
CGI.
CGI- ()
CGI- - (PHP, Perl, Bash, Phyton .) , C, . CGI- C:
#include <time.h> // rand()
#include <stdio.h> // /
#include <stdlib.h> // — rand()
// . .
void main(void) {
//
int Num; time_t t; srand(time(&t));
// Num 0 9
Num = rand()%10;
// . — html-
printf("Content-type: text/html\n");
//
printf("Pragma: no-cache\n");
//
printf("\n");
// —
printf("<html><body>");
printf("<h1>!</h1>");
printf(" 0-9: %d",Num);
printf("</body></html>");
}
() cgi.exe , CGI-.
, , .
PHP.SU: | PHP |