/ Published in: Python
URL: http://forum.zloy.bz/showthread.php?t=91783
by mrgrek
Expand |
Embed | Plain Text
<?php include 'geoip.inc.php'; $geo = geoip_open( "GeoIP.dat", GEOIP_STANDARD ); $ip = $_SERVER['REMOTE_ADDR']; //$ip = '123.45.67.89'; $cntry = $geo->GEOIP_COUNTRY_NAMES[array_search(strtoupper(geoip_country_code_by_addr($geo, $ip)), $geo->GEOIP_COUNTRY_CODES)]; if (strlen($cntry) == 0) $cntry = 'Unknown'; echo 'your IP: <b>'.$_SERVER['REMOTE_ADDR'].'</b>; You are from: <b>'.$cntry.'</b>.'; ?>
Comments
Subscribe to comments
You need to login to post a comment.

Not Python but PHP