1

using $_SERVER['HTTP_CLIENT_IP'] is not providing the client's ip address.

What could be the reason?

2
  • Client machine may be behind an proxy or a NATed network connection. Try HTTP_X_FORWARDED_FOR or REMOTE_ADDR as well Commented Jun 20, 2016 at 11:52
  • 7
    How to get the client IP address in PHP? Commented Jun 20, 2016 at 11:52

2 Answers 2

3

Try $_SERVER['REMOTE_ADDR'] or $_SERVER['REMOTE_HOST']. That will give you your clients remote IP.

Sign up to request clarification or add additional context in comments.

Comments

2

you can use:

  • $_SERVER['REMOTE_ADDR']
  • $_SERVER['HTTP_CLIENT_IP']
  • $_SERVER['HTTP_X_FORWARDED_FOR']

1 Comment

NOTE: Make sure you take look at here, before just using $_SERVER['HTTP_X_FORWARDED_FOR']

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.