PHP Hostname Code Demo
Below is the output of the hostname demo code.
PHP Hostname using first code
Server IP: 8.12.35.78
Server Name: z13459AA.textdrive.com
If you do not want to see the IP address of your website, you can use this single line of code:
echo "Server Name: " . gethostbyaddr (gethostbyname ($_SERVER["SERVER_NAME"]));
PHP Hostname using second code
Server Name: z13459AA.textdrive.com
Back to PHP hostname code.
Back to PHPLabs section for more PHP code!
