There are many websites which give the users to find their IP address. But still, it is a good and nerdy trick if you would add this feature in your website, it will make a good impression in your user’s mind. Guess what!! you need only two line PHP code to accomplish this task.

Find website visitors ip address

This feature will also help you to put location-based advertisements on your page according to your visitor’s location on the globe. What you need is just this 2 line of code which contains one function that fetches the users IP address accurately. The function which is going to help you is getenv(“REMOTE_ADDR”).

Wait! What ??? That’s It.

Yeah, that’s about it.

For more convenience, the full four line code is given below.

Just paste this code in your source code and you are good to go. If you want to check how it works you can click on below link to check it’s accuracy.

www.techmuzz.com/whatismyip

Please let us know what do you think about this trick or have any suggestions for us in the comment section below. Thank you and Stay Techie…