How to get current real User/Client ip address in PHP

How to use $_SERVER[‘REMOTE_ADDR’] to get current user IP address and show on screen.

Detecting and saving current user ip is one of the most important things for every website because at the present times lots of people trying to access your website to unleash the wrong content on internet and if you have stored all visitors IP address then this will help you to track down the wrong persons. So this is also a security point. PHP gives us inbuilt $_SERVER methods to access the real time visitor ip address. So here is the complete step by step tutorial for How to get current real User/Client ip address in PHP and disply on screen.

android-project-download-code-button

How to get current real User/Client ip address in PHP.

Code for get-ip.php file.

 <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>

<?php

 $UserIP = $_SERVER['REMOTE_ADDR'];
 
 echo $UserIP;
?>

</body>
</html>

Click here to download How to get current real User/Client ip address in PHP project file with source code.

Leave a Reply

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