Today we will discuss How to Check IP address in PHP. we use a single line code for getting the IP Address and than another single line to show it. It just a 10 second script.
In this we will use $_SERVER[“REMOTE_ADDR”]. – We will put $_SERVER[“REMOTE_ADDR”] into a variable and than we will echo that variable. It will show us the IP address. Below is the code sample and the IP your PC.
<?php $ip=$_SERVER["REMOTE_ADDR"]; echo $ip; ?>
It will show your IP.
Happy Coding.
No Comments