Programming Great Village

Using $_SERVER variable in php

$_SERVER variable is a ‘superglobal’ in php that gives the information about headers , paths, script name , etc.

Some examples of this variable are as follows:

1     <?php

2     echo $_SERVER['PHP_SELF'];

3     //The filename of the currently executing script, relative to the document root.

4     echo $_SERVER['SERVER_ADDR'];

5     // The IP address of the server under which the current script is executing.

6     echo $_SERVER['SERVER_NAME'];

7     // The name of the server host under which the current script is executing. for example : ''


9     // Server identification string, given in the headers when responding to requests.

10     echo $_SERVER['REQUEST_METHOD'];

11     // Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'.


13     // Contents of the Accept-Charset: header from the current request, if there is one. Example: 'iso-8859-1,*,utf-8'.

14     echo $_SERVER['HTTPS'];

15     // Set to a non-empty value if the script was queried through the HTTPS protocol.

16     echo $_SERVER['CRIPT_FILENAME'];

17     // The absolute pathname of the currently executing script.

18     ?>

Keywords :php$_SERVERIP addressServerHTTPS
Written by : amindelavar  |  Posted on : 2016/12/29-21:44   |  Number of Visitors :67
Post a comment  (You must first register on the site to be able to comment.)

Is this article useful ?    Yes    No

If you have more time, you can make your opinion more fully described below :

Search Box
Recent Posts
Most Viewed Posts
Site Statistics

 All articles available : 16

 The number of Registered Users : 5

 Last Updated site : 1 year(s) ago

 Visitors Today(Unique IP) : 33

 Visitors Yesterday(Unique IP) : 19

 Total Visitors(Unique IP) : 5978