Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to code feature on checking visitor IP address in PHP?

I still confused on this subject and ask for any help and reference on how to check a visitor IP address via PHP.

I'm know it seems lazy to ask something before attempting to code something to show, but right now, I am also googling to find it. Hopefully someone can give general broad answer or some link to read?

BTW, what is to be considered when we have to code some feature like this?

PS: Thank you very much everybody. It's been enlightening arguments. Frankly, I choose the answer more as respect rather than the truth in it. Because until now I still don't know the right one. Maybe I need more years of learning before I get a firm understanding of the topic itself.

like image 811
justjoe Avatar asked Dec 02 '22 05:12

justjoe


1 Answers

See $_SERVER, specifically:

$_SERVER['REMOTE_ADDR'];
like image 86
jasonbar Avatar answered Jan 26 '23 01:01

jasonbar