junejune Posted September 8, 2014 Share Posted September 8, 2014 IP2Location PHP module supports IPv6 queries now. <?php require_once('IP2Location.php'); // Standard lookup with no cache $loc = new IP2Location('databases/DB24.BIN'); /* Cache whole database into system memory and share among other scripts & websites WARNING: Please make sure your system have sufficient RAM to enable this feature */ //$loc = new IP2Location('databases/DB24.BIN', IP2Location::SHARED_MEMORY); /* Cache the database into memory to accelerate lookup speed WARNING: Please make sure your system have sufficient RAM to enable this feature */ //$loc = new IP2Location(ROOT . 'databases/DB24.BIN', IP2Location::MEMORY_CACHE); $ip = $_SERVER['REMOTE_ADDR']; $record = $loc->lookup($ip, IP2Location::ALL); echo 'IP Address: ' . $record->ipAddress . '<br />'; echo 'IP Number: ' . $record->ipNumber . '<br />'; echo 'ISO Country Code: ' . $record->countryCode . '<br />'; echo 'Country Name: ' . $record->countryName . '<br />'; echo 'Region Name: ' . $record->regionName . '<br />'; echo 'City Name: ' . $record->cityName . '<br />'; echo 'Latitude: ' . $record->latitude . '<br />'; echo 'Longitude: ' . $record->longitude . '<br />'; echo 'ZIP Code: ' . $record->zipCode . '<br />'; echo 'Time Zone: ' . $record->timeZone . '<br />'; echo 'ISP Name: ' . $record->isp . '<br />'; echo 'Domain Name: ' . $record->domainName . '<br />'; echo 'Net Speed: ' . $record->netSpeed . '<br />'; echo 'IDD Code: ' . $record->iddCode . '<br />'; echo 'Area Code: ' . $record->areaCode . '<br />'; echo 'Weather Station Code: ' . $record->weatherStationCode . '<br />'; echo 'Weather Station Name: ' . $record->weatherStationName . '<br />'; echo 'MCC: ' . $record->mcc . '<br />'; echo 'MNC: ' . $record->mnc . '<br />'; echo 'Mobile Carrier Name: ' . $record->mobileCarrierName . '<br />'; echo 'Elevation: ' . $record->elevation . '<br />'; echo 'Usage Type: ' . $record->usageType . '<br />'; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.