0

I'm not able to get the users ip in the regular way due to tcp proxying. So I need an alternative.

I tried this:

$ip = file_get_contents('http://wtfismyip.com/text');

Output was server ip. Is there any way I can get the users ip?

nvanesch
  • 2,540
  • 14
  • 25

1 Answers1

3

There are multiple ways you can do this.

Depending on the proxy you might want to see if x-forwarded-for http://en.wikipedia.org/wiki/X-Forwarded-For is set.

Jou could have a JS on the client check the IP and send it with your request. How to get client's IP address using javascript only?

Community
  • 1
  • 1
nvanesch
  • 2,540
  • 14
  • 25