Difference between revisions of "GetServerVariable"
(jrfconvert import) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | {{HelpFiles}} | |
− | | ||
− | ====getServerVariable==== | + | ==== getServerVariable ==== |
− | Returns the string corresponding to the requested serverVariable. | + | Returns the string corresponding to the requested serverVariable. |
− | '''Syntax''' | + | '''Syntax''' |
− | getServerVariable(''serverVariable'') | + | getServerVariable(''serverVariable'') |
− | '''Arguments''' | + | '''Arguments''' |
− | ''serverVariable'': a number expression. It must be one of 3 pre-defined constants: | + | ''serverVariable'': a number expression. It must be one of 3 pre-defined constants: |
− | * HTTP_REFERER: Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty | + | *HTTP_REFERER: Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty |
− | * HTTP_USER_AGENT: Returns a string describing the browser that sent the request. | + | *HTTP_USER_AGENT: Returns a string describing the browser that sent the request. |
− | * REMOTE_ADDR: Returns the IP address of the remote host making the request (reference: http://www.w3schools.com/asp/coll_servervariables.asp) | + | *REMOTE_ADDR: Returns the IP address of the remote host making the request (reference: http://www.w3schools.com/asp/coll_servervariables.asp) |
− | '''Return type''' | + | '''Return type''' |
− | string | + | string |
− | '''Examples''' | + | '''Examples''' |
− | getServerVariable(HTTP_REFERER); | + | ''string a = getServerVariable(HTTP_REFERER);'' |
− | '' | + | ''print(a); '' |
− | Version 5.3 | + | ''//Returns the URL of the page that referred the request to the current page'' |
− | __NOTOC__ | + | |
− | <!-- imported from file: 3243.htm--> | + | ''//Result: http://[sitename].catglobe.com/DataModule/DataCache/CGScriptPromptPage.aspx?type=DataCacheSpecification&id=[id]'' |
+ | |||
+ | ''//------------------------------'' | ||
+ | |||
+ | ''string b = getServerVariable(HTTP_USER_AGENT);'' | ||
+ | |||
+ | ''print(b); '' | ||
+ | |||
+ | ''//Returns a string describing the browser that you're using to run script '' | ||
+ | |||
+ | ''//Result: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)'' | ||
+ | |||
+ | ''//------------------------------'' | ||
+ | |||
+ | ''string c = getServerVariable(REMOTE_ADDR);'' | ||
+ | |||
+ | ''print(c); '' | ||
+ | |||
+ | ''//Returns your computer's IP (e.g: 192.168.1.10)'' | ||
+ | |||
+ | '''Availability''' | ||
+ | |||
+ | Version 5.3 __NOTOC__ <!-- imported from file: 3243.htm--> | ||
+ | |||
+ | [[Category:Network_Functions]] |
Latest revision as of 09:34, 22 December 2011
getServerVariable
Returns the string corresponding to the requested serverVariable.
Syntax
getServerVariable(serverVariable)
Arguments
serverVariable: a number expression. It must be one of 3 pre-defined constants:
- HTTP_REFERER: Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty
- HTTP_USER_AGENT: Returns a string describing the browser that sent the request.
- REMOTE_ADDR: Returns the IP address of the remote host making the request (reference: http://www.w3schools.com/asp/coll_servervariables.asp)
Return type
string
Examples
string a = getServerVariable(HTTP_REFERER);
print(a);
//Returns the URL of the page that referred the request to the current page
//Result: http://[sitename].catglobe.com/DataModule/DataCache/CGScriptPromptPage.aspx?type=DataCacheSpecification&id=[id]
//------------------------------
string b = getServerVariable(HTTP_USER_AGENT);
print(b);
//Returns a string describing the browser that you're using to run script
//Result: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)
//------------------------------
string c = getServerVariable(REMOTE_ADDR);
print(c);
//Returns your computer's IP (e.g: 192.168.1.10)
Availability
Version 5.3