To Get And Show The IP Address

Before we see how to display the IP Address let us learn little bit about IP Address. Whenever you are connected to internet you are assigned an IP address. This distinguishes your computer from other computers on the internet. Your IP Address can be static or dynamic. The following code can be used to get and show the IP Address on the webpage.


Javascript

var ip= '<!--#echo var="REMOTE_ADDR"-->';
document.write("Your IP Address is :"+ip+" ");


ASP

request.ServerVariables("REMOTE_ADDR")


PHP

<?
$remote_address = getenv("REMOTE_ADDR");
echo "Your IP address is $remote_address.";
$browser_type = getenv("HTTP_USER_AGENT");
echo "You are using $browser_type.";
?>


0 comments to "To Get And Show The IP Address"

Post a Comment