How to get IP address of Client in PHP ?

Simple PHP program to get IP address and name of Client


echo "<h3>Welcome ! Your IP address is: "  .$_SERVER['REMOTE_ADDR'];
echo "<br/>Your Computer Name is: ".$_SERVER['HTTP_HOST']."</h3>";


PHP has $_SERVER superglobal array which provides important information about Client and Server.

$_SERVER['REMOTE_ADDR'] - gives IP address of Client accessing website.
$_SERVER['HTTP_HOST']     - gives Host name of Client accessing website.

No comments:

Post a Comment

Thanks for visiting my Blog!

Have a Question ? Need Help in College Assignments, Need Code that is not available here? Just leave a comment & get your code instantly.

Tips to Enhance Your Blog