How to get the client IP address in PHP

Sometimes you need to get the client side the IP address to implement some features in web application using PHP programming language. In this tutorial, we will share 2 line PHP code to get the client IP address.

How to get the client IP address in PHP

Copy the below PHP code and use it inside your PHP script to print the IP address.


Your IP is

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.