James John – Software Engineer

Detect Real Client IP from Proxy Using PHP

Fetching out proxy users and exposing their real IP is what I really enjoy, I remember using Google Search in Opera Mini Mobile which uses its proxy to forward. But to my suprise, it got to know am in Nigeria and redirect me to .com.ng 😀 .
So glad to find out PHP doing this, which makes our site or project more mature and advance 🙂 . In PHP simply use the  $_SERVER[‘HTTP_X_FORWARDED_FOR’]  ðŸ™‚
$_SERVER[‘HTTP_X_FORWARDED_FOR’] is only available if the server detects the client using a proxy else it turns empty or unavailable. This looks for original IP that is been forwarded.
Now lets use this function, firstly lets check if the client is really using a Proxy and echo his real IP
we are done with that and the above code will only run if he is on proxy, now lets write one that will tell the Client he/she is not using proxy if necessary 🙂
I guess we are done here, below is the full code

James John

Software Engineer