Pages

How to Find IP Address With Using PHP Code

Check out, how to find the IP address of your computer with using php code. It is one of the basic things in php as well as very simple. Here, I am going to explain how to get the true ip address with only using php code. Let me explain in detail.

Find IP Address With Using PHP Code


Check out the code in detail :-

<?php
function getRealIpAddress()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
//check ip from internet
{
$ipadd=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
//check ip proxy
{
$ipadd=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ipadd=$_SERVER['REMOTE_ADDR'];
}
return $ipadd;
}
echo getRealIpAddress(); // display IP address
?>

ethan

Phasellus facilisis convallis metus, ut imperdiet augue auctor nec. Duis at velit id augue lobortis porta. Sed varius, enim accumsan aliquam tincidunt, tortor urna vulputate quam, eget finibus urna est in augue.

No comments:

Post a Comment