bookmark_borderGet IPv4 address with PHP explained

Do you know how to get an IPv4 address with PHP from a host? No. Now It is your time to learn it and start using it in your code. It is very simple, don’t worry.

$_SERVER and REMOTE_ADDR

We can get the IP address of the user with $_SERVER in PHP. The information about the user and its activities could help us for security or marketing purposes. 

The most basic way to collect this information in PHP is with REMOTE_ADDR. The answer will be the IP address of the user that is currently on the webpage.

Example code:

Continue reading “Get IPv4 address with PHP explained”