CGI_Environ
<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > CGI > CGI_Environ |
Description
Retrieves the contents of requested environment variable.
Syntax
s = CGI_Environ(VariableName)
Returns
Return a string value.
The contents of specified environment variable.
Parameters
Name |
Type |
Optional |
Meaning |
VariableName |
String |
No |
The environment variable name to query for. |
Remarks
This function is like OS_Environ function but you don't need to use OS module if you do not need it into your CGI scripts.
Environment variables are a series of hidden values that the web server sends to every CGI program that is run. You can use these variables for many different purposes within your own CGI programs.
Below is an example of the typical variables that a web server may have available to you.
Variable |
Value |
DOCUMENT_ROOT |
The root directory (folder) of your server |
HTTP_COOKIE |
The visitor's cookie, if one is set |
HTTP_HOST |
The hostname of the page being attempted |
HTTP_REFERER |
The URL of the page that called your program |
HTTP_USER_AGENT |
The browser type of the visitor |
HTTPS |
"on" if the program is being called through a secure server |
PATH |
The system path (folder) your server is running under |
QUERY_STRING |
The query string passed to your program |
REMOTE_ADDR |
The IP address of the visitor |
REMOTE_HOST |
The hostname of the visitor |
REMOTE_PORT |
The port the visitor is connected to on the web server |
REMOTE_USER |
The visitor's username (for .htaccess protected pages) |
REQUEST_METHOD |
GET or POST |
REQUEST_URI |
The interpreted pathname of the requested document or CGI (relative to the document root) |
SCRIPT_FILENAME |
The full pathname of the current CGI |
SCRIPT_NAME |
The interpreted pathname of the current CGI program (relative to the document root) |
SERVER_ADMIN |
The email address for your server's webmaster |
SERVER_NAME |
Your server's fully qualified domain name (e.g. www.cgiconnection.com) |
SERVER_PORT |
The port number your server is listening on |
SERVER_SOFTWARE |
The server software you're using |
Some servers set other environment variables as well. Depending on yours, you may have more or less. Notice that some environment variables give information about your server, and will never change (such as SERVER_NAME and SERVER_ADMIN), while others give information about the visitor, and will be different every time someone accesses the program.
Restrictions
See also
Examples
Echo("OS: " + CGI_Environ("OS")) 'Example result: OS = Windows_NT