PHP script to get the user or client IP address

ip

To get the client IP address

<?php
$strCurrentTime = date(“y-m-d h:i:s”,time());
$strIP = $_SERVER[‘REMOTE_ADDR’];
echo $strIP;
?>

output

127.0.0.1

Note: IP address is dynamic so output may differ.

Leave a Comment

Your email address will not be published. Required fields are marked *