Skip to content

Instantly share code, notes, and snippets.

@ericstone57
Created November 24, 2020 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericstone57/1c012cfad96e29ad3ae9486b71fe166c to your computer and use it in GitHub Desktop.
Save ericstone57/1c012cfad96e29ad3ae9486b71fe166c to your computer and use it in GitHub Desktop.
Get IP Address
// uses isset to remove notices
$ip = isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment