| | at : |
Archive

PHP $_SEVER를 이용한 서버, 웹 주소 정보 가져오기 하훌 rwxr-xr-x 0 5/31/2015



PHP $_SEVER를 이용한 서버, 웹 주소 정보 가져오기

Permission rw-r--r--
Author 하훌
Date and Time 5/31/2015
Label
License 크리에이티브 커먼즈 라이선스


1. $_SERVER 를 이용하여 웹 주소 정보 가져오기


<?

$hostname=$_SERVER["SERVER_NAME"];    // sever 정보 ex) www.codebalck.net
$hostname2=$_SERVER["HTTP_HOST"];    // host 정보 ex) www.codebalck.net
$uri= $_SERVER["REQUEST_URI"];          // uri 정보 ex) /2015/05/php-sever.html

?>

2. $_SERVER 주요 속성(elements)


'GATEWAY_INTERFACE'
What revision of the CGI specification the server is using; i.e. 'CGI/1.1'.
'SERVER_ADDR'
The IP address of the server under which the current script is executing.
'SERVER_NAME'
The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.
'SERVER_SOFTWARE'
Server identification string, given in the headers when responding to requests.
'SERVER_PROTOCOL'
Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0';
'REQUEST_METHOD'
Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'.  

'REQUEST_TIME'
    The timestamp of the start of the request. Available since PHP 5.1.0.
'REQUEST_TIME_FLOAT'
    The timestamp of the start of the request, with microsecond precision. Available since PHP 5.4.0.
'QUERY_STRING'
    The query string, if any, via which the page was accessed.
'DOCUMENT_ROOT'
    The document root directory under which the current script is executing, as defined in the server's configuration file.
'HTTP_ACCEPT'
    Contents of the Accept: header from the current request, if there is one.
'HTTP_ACCEPT_CHARSET'
    Contents of the Accept-Charset: header from the current request, if there is one. Example: 'iso-8859-1,*,utf-8'.
'HTTP_ACCEPT_ENCODING'
    Contents of the Accept-Encoding: header from the current request, if there is one. Example: 'gzip'.
'HTTP_ACCEPT_LANGUAGE'
    Contents of the Accept-Language: header from the current request, if there is one. Example: 'en'.
'HTTP_CONNECTION'
    Contents of the Connection: header from the current request, if there is one. Example: 'Keep-Alive'.
'HTTP_HOST'
    Contents of the Host: header from the current request, if there is one.
'HTTP_REFERER'
    The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
'HTTP_USER_AGENT'
    Contents of the User-Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Among other things, you can use this value with get_browser() to tailor your page's output to the capabilities of the user agent.




Share







HAHWUL
HACKING | PENETRATION-TEST | CODING
HACKERONE : GIT : 0DAY-TODAY : EXPLOIT-DB : PACKETSTORM
GOOGLE+ | HAHWUL@GMAIL.COM | TWITTER
WWW.HAHWUL.COM




0 개의 댓글:

댓글 쓰기