HTTP HOST server variable - how to find server ip address in php

HTTP_HOST server variable - how to find server ip address in php

how-to-find-server-ip-address-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>HTTP_HOST server variable - how to find server ip address 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="HTTP_HOST server variable - how to find server ip address in php">
  <meta name="keywords" content="php, example, code, array, function, money_format, string, HTTP_HOST, server variable">
  <meta name="description" content="HTTP_HOST server variable - how to find server ip address in php">
  <style>
   h2, h4{background:#eee; color:#000085;}
   h2{ padding:3px; margin:3px; font-size:22px;}
   h4{ padding:2px; margin:2px; font-size:19px;}
   p{padding:2px; margin:2px; color:#0099bb;}
   body{ background:#FFFFFc;}
  </style>
 </head>
 <body>
  <h2>HTTP_HOST server variable - how to find server ip address in php</h2>
  <pre>
   <?php
    /*
     ---------------------------------------------------------
     we want to find hosting server's ip address
     we can do this by using HTTP_HOST server variable in php
     ---------------------------------------------------------
    */
    echo "<h4>hosting server's ip address by using HTTP_HOST server variable</h4>";
    echo $_SERVER['HTTP_HOST'];
    /*
     -------------------------------------------------------
     since my program is running in the local machine
     HTTP_HOST server variable shows 127.0.0.1 as localhost
     in production server it will show real ip address.
     in professional programming it is used rapidly.
     -------------------------------------------------------
    */
   ?>
  </pre>
 </body>
</html>

how to find server admin in php - fine server admin's contact or email address by SERVER_ADMIN server variable - output in the browser

No comments:

Post a Comment

leave your comments here..