Local And Remote IP Address

by Hiroshi on June 13, 2008

in IP Address

Sometimes user might be using a shared IP Address for internet then how can we find his real remote IP Address which will be his Server’s IP Address and his own local IP Address or his Machine’s IP Address.

Here it is.

<?php
$domain=$_SERVER['REMOTE_ADDR'];
$domain1 = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
echo "Viewer Server's (Remote) IP Address: <strong>$domain</strong> - ";
echo "Viewer Real (Local-Machine) IP Address: <strong>$domain1</strong>";
?>

Related Posts

Previous post:

Next post: