Skip to content

Instantly share code, notes, and snippets.

@jimmysawczuk
Created September 13, 2012 14:28
Show Gist options
  • Save jimmysawczuk/3714656 to your computer and use it in GitHub Desktop.
Save jimmysawczuk/3714656 to your computer and use it in GitHub Desktop.
grab IP
<?php
function getIP()
{
return !empty($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER["HTTP_X_FORWARDED_FOR"]
: (
!empty($_SERVER['REMOTE_ADDR'])? $_SERVER['REMOTE_ADDR']
: ''
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment