SERVER_NAME server variable - how to find hosting server's name in php
how-to-find-hostin-server-name-in-php.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SERVER_NAME server variable - how to find hosting server's name in php</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Md Iqbal Hosan">
<meta name="title" content="SERVER_NAME server variable - how to find hosting server's name in php">
<meta name="keywords" content="php, example, code, array, function, money_format, string, SERVER_NAME, server variable">
<meta name="description" content="SERVER_NAME server variable - how to find hosting server's name in php">
<style>
h2, h4{background:#ddd; color:#000083;}
h2{ padding:3px; margin:3px; font-size:21px;}
h4{ padding:2px; margin:2px; font-size:18px;}
p{padding:2px; margin:2px; color:#0099cc;}
body{ background:#FFFFFd;}
</style>
</head>
<body>
<h2>SERVER_NAME server variable - how to find hosting server's name in php</h2>
<pre>
<?php
/*
---------------------------------------------------------
we want to find hosting server's name
we can do this by using SERVER_NAME server variable in php
---------------------------------------------------------
*/
echo "<h4>hosting server's name by using SERVER_NAME server variable</h4>";
echo $_SERVER['SERVER_NAME'];
/*
-----------------------------------------------------------
since my program is running in the local machine
SERVER_NAME server variable shows localhost or 127.0.0.1 as server name
in production server it will show real server name.
in professional programming it is used rapidly.
-----------------------------------------------------------
*/
?>
</pre>
</body>
</html>

No comments:
Post a Comment
leave your comments here..