Home
 
 
Search:  
C C++ Perl PHP Python HTML ShellScripts
 
 
  Coding Books
  Tutorials
  Search Code
  Browse Code
  Link to Us
  Site News
  Contact Metalshell
 
 
 
  Submit Code   Statistics
 



Perl and CGI for the World Wide Web: Visual QuickStart Guide, Second Edition    (ISBN: 0201735687)


 

 List Price: $19.99
 Our Price: $13.99
 Used Price: $11.08

 Release Date: 29 May, 2001
 Manufacturer: Peachpit Press (Paperback)
 Sales Rank: 7,125

 Author: Elizabeth Castro









More Info

 CGI Environment Variables 2002-08-11 10:05:02
  perl 
Category: source:perl:cgi
Description: Explination of the environment variables that PERL handles and uses.
Platform: unix
Author: Snap
Viewed: 2327
Rating: 3/5 (4 votes)
If you have any questions about this piece of code or still need help, try posting your question on the forum.

 

Printable Version
envvar.cgi
#!/usr/bin/perl
print "Content text:html/text\n\n";

##########################################
#                                        #
#                                        #
#   Written by Snap                      #
#           (iam@someoneshouse.com)      #
#                                        #
#   For Metalshell                       #
#       http://www.metalshell.com        #
#                                        #
#  This is a simple script, more of an   #
#  example of all the possible           #
#  environment variables that can be     #
#  used and handled by PERL.             #
#                                        #
##########################################


print<<STOP

<html>
<body>


Your Gateway Interface Type (Usually Common Gateway Interface or CGI)<BR>
$ENV{GATEWAY_INTERFACE}<br><br>

Addresses that your Webserver Accepts<br>
$ENV{HTTP_ACCEPT}<br><br>

Your HTTP Connection Type<br>
$ENV{HTTP_CONNECTION}<br><br>

The Host Name<br>
$ENV{HTTP_HOST}<br><br>

Type of browser you're using<br>
$ENV{HTTP_USER_AGENT}<br><br>

Remote User's Host Name<br>
$ENV{REMOTE_HOST}<br><br>

Remote User's IP Address<br>
$ENV{REMOTE_ADDR}<br><br>

Remote User's Connecting Port<br>
$ENV{REMOTE_PORT}<br><br>

HTTP Request Method (Generally GET)<br>
$ENV{REQUEST_METHOD}<br><br>

The Scripts Filename<br>
$ENV{SCRIPT_FILENAME}<br><br>

The Name of the Script<br>
$ENV{SCRIPT_NAME}<br><br>


Type of Web server used for hosting on server<br>
$ENV{SERVER_SOFTWARE}<br><br>

Server Admin's E-mail (or Identification)<br>
$ENV{SERVER_ADMIN}<br><br>

Port the server is accepting HTTP requests on<br>
$ENV{SERVER_PORT}<br><br>

Protocol The server is using<br>
$ENV{SERVER_PROTOCOL}<br><br>

The Query String, passed by other scripts or HTTP<br>
$ENV{QUERY_STRING}<br><br>

General Path Information<br>
$ENV{PATH_INFO}<br><br>

The Translated Path<br>
$ENV{PATH_TRANSLATED}<br><br>

What type of content was passed<br>
$ENV{CONTENT_TYPE}<br><br>

Length of the content<br>
$ENV{CONTENT_LENGTH}<br><br>

Server's Domain Name<br>
$ENV{SERVER_NAME}<br><br>

<\/body>
<\/html>
STOP
Rate this code:
(Not Helpful)  (Very Helpful) 

 
 
   Developer.*  
   Blue Parrots  
   Technipal  
   Defy Magazine  
   Code Project  
   Prog. Heaven  


Got Money?