How to Retrieve Users’ IP Address with PHP

Hello,

In a website I was making, I had a rating system in which votes were by unique IP address. It was very easy to retrieve it, yet there are people that may not know so I share it with all of you.

1. In your PHP file, you will obtain the IP from the global array $_SERVER. To obtain the IP we will get ‘REMOTE_ADDR’ and we will save it in a variable:

$ip = $_SERVER['REMOTE_ADDR'];
print $ip;

That was easy, right? If you have any questions, comments, suggestions for articles, please do not hesitate to contact me and I’ll be more than glad to assist you.

Best Regards,

Richi

Owner of Juapo2Services

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , | Posted under Programming/Coding | RSS 2.0

Author Spotlight

Richi González

Richi González

I started programming when I was 12. I'm a Developer and have been working with the Clip-Bucket script since it came out. I'm the Liaison between Arvixe and Clip-Bucket, so anything you need regarding Clip-Bucket or any particular computer-related subject you need, let me know so I can assist you.

Comments are closed.