Explain with code how to get a user’s IP address.


Explain with code how to get a user’s IP address.

The users IP address can be returned by specifying the host name as aparameter in gethostbyname(“hostname”) method.

Example:

<?php
$ip = gethostbyname(‘www.sample.com’);
echo $ip;
?>

Leave a comment