Ways to run cgi-scripts on web page?

Started by
4 comments, last by stefu 21 years ago
Hello, I''d like to know what kind of ways there are to run cgi-script on web page. I know the following:
  
* directly open script.cgi in browser

* <script language="JavaScript" src="script.cgi"></script> where script.cgi prints javascript code.

* <img src="script.cgi"/> where script.cgi prints image location

  
Are there other ways?
Advertisement
CGI is a server application. IT DOES NOT RUN ON THE CLIENT. Perl is cgi. &#106avascript is not.
quote:Original post by Anonymous Poster
CGI is a server application. IT DOES NOT RUN ON THE CLIENT. Perl is cgi. &#106avascript is not. <hr height=1 noshade></SPAN></BLOCKQUOTE> <br><br>Well, I know this. Just used wrong words. <br>So how to put cgi-script produced code to html page?
When the CGI script is executed by the webserver, then anything it sends to stdout will be sent to the client.
The web server needs to provide a cgi binary directory, you need to put your cgi application in there, and you need to call that application by accessing a url, often with a POST or GET from a form.
Anything you can get from a webserver, like an html page, an image, a block of &#106avascript, any other kind of file; any of these things you can use a script for instead. usually you''d set it up so it was obvious that it was a script by the filename: index.php instead of index.html for example, but it doesn''t have to be. you could set your webserver up to handle requests for "image.gif" by running a php script and sending its output (presumably, gif image data) instead of just serving a static file.

setting up your webserver to run scripts / CGIs of whatever sort (compiled C, shell scripts, perl, php, etc) and how you want to handle their naming is a matter of reading your webserver documentation.

I reccomend playing around with apache+php, all should become clear.

--
Jon
(weeeeeeeeeeeeeeeeeee)
--Jon(weeeeeeeeeeeeeeeeeee)

This topic is closed to new replies.

Advertisement