Ok here is the code with a bug catcher to catch non-resolved IPs as un4given1 pointed out. $ip = The IP $isp = The domain you need to prefix it with "www." $endos = The OS // get IP and resolve IP $ip = $REMOTE_ADDR; $resolved = gethostbyaddr ($REMOTE_ADDR); // check for non resolve of IP and rip domain if resolved if ($resolved == $ip) { $isp = ".. Can't Resolve IP"; } else { $str = preg_split("/\./", $resolved); $i = count($str); $x = $i - 1; $n = $i - 2; $isp = $str[$n] . "." . $str[$x]; } // Simple OS Detection $os = $HTTP_USER_AGENT; $oslist = Array ( // Windows "Win|Windows", "Win16|Windows", "Win95|Windows 95", "Win98|Windows 98", "WinME|Windows ME", "Win32|Windows", "WinNT|Windows NT", "Windows 3.1|Windows 3.1", "Windows 95|Windows 95", "Windows CE|Windows CE", "Windows 98|Windows 98", "Windows ME|Windows ME", "Windows NT|Windows NT", "Windows NT 5.0|Windows 2000", "Windows NT 5.1|Windows XP", // Macintosh "Mac_68000|MacOS m68K", "Mac_68K|MacOS m68K", "Mac_PowerPC|MacOS PPC", "Mac_PPC|MacOS PPC", "Macintosh|MacOS", // Unices "X11|UNIX", "BSD|BSD", "SunOS|SunOS", "IRIX|IRIX", "HP-UX|HP-UX", "AIX|AIX", "QNX|QNX", "SCO_SV|SCO UNIX", "FreeBSD|FreeBSD", "NetBSD|NetBSD", // Linux "Linux|Linux", "Debian|Debian GNU/Linux", // Other "BeOS|BeOS", "OS/2|OS/2", "AmigaOS|AmigaOS", ); foreach ($oslist as $osnow) { $osnow = explode ("|", $osnow); if (eregi ($osnow[0], $os)) { $endos = $osnow[1]; $check = "No"; } elseif ($check != "No") { $endos = "Unknown"; } }