Find out IP address

We can get the IP address of any visitor by using PHP. Finding the IP address is very important requirement for many scripts where we store the members or visitors details. For security reason we can store IP address of our visitors who are doing any purchases or recording the geographical location of the visitor can be done this way. Some time based on the IP address we can redirect the browser to different areas of the site. There are many applications using this and here is the PHP code to know the IP address of any visitor to the site.

<?php
     //Get IP Address
     $ip = $_SERVER['REMOTE_ADDR'];
     echo "<b>IP Address= $ip</b>";
?>

Permanent link to this article: https://blog.openshell.in/2010/11/find-out-ip-address/

Leave a Reply

Your email address will not be published.