Network data on the hosting server - PHP

Description

How to return and display values ( server address , server port ,
remote address , remote port , server protocol , request uri ,
request method ) ​​from the hosting server when a request
( request method => GET ) is made to the hosting server .

Code


          $_SERVER <br/><br/>
        
        <?php
        
        print('REQUEST_URI  => ' .$_SERVER['REQUEST_URI'] . '<br/>');
        print('SERVER_ADDR  => ' .$_SERVER['SERVER_ADDR'] . '<br/>');
        print('SERVER_PORT  => ' .$_SERVER['SERVER_PORT']. '<br/>');        
        print('REMOTE_ADDR  => ' .$_SERVER['REMOTE_ADDR']. '<br/>');
        print('REMOTE_PORT  => ' .$_SERVER['REMOTE_PORT']. '<br/>');
        print('SERVER_PROTOCOL  => ' .$_SERVER['SERVER_PROTOCOL']. '<br/>');
        print('REQUEST_METHOD  => ' .$_SERVER['REQUEST_METHOD']. '<br/>');
            
        ?>
            

----The PHP version used in this example is 8.5.0 ----

Video

Watch video on YouTube…

Related tutorial :

$_SERVER - PHP ( request uri - query string )

Previous : Short Ternary Operator ( ?: ) - PHP …

Next : Null Coalescing Operator ( ?? ) - PHP …

^