Get Website Lowest price!

Wordpress Experts!

×

php up to date

Get an IP address of the user

Get an IP address of the user


<html>
<head>
 <title>What is my IP address?</title>
</head>
<body>
<?php
 
    if (getenv('HTTP_X_FORWARDED_FOR')) {
        $pipaddress = getenv('HTTP_X_FORWARDED_FOR');
        $ipaddress = getenv('REMOTE_ADDR');
echo "Your Proxy IP address is : ".$pipaddress. "(via $ipaddress)" ;
    } else {
        $ipaddress = getenv('REMOTE_ADDR');
        echo "Your IP address is : $ipaddress";
    }
?>
</body>
</html>
 
If GEOIP database installed and configured using Apache/Nginx/Lighttpd, try the following php code to get the visitors country name:
 
   $country = getenv('GEOIP_COUNTRY_NAME');
   echo "Your country : $country";
 
SHARE

blogger

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment