My favorites | Sign in
Project Home Downloads Wiki Source
Search
for
Rych_Ip2Location  
Description of the Rych_Ip2Location component
Updated Oct 11, 2010 by rchouinard

Rych_Ip2Location

This component provides simple access to the commercial ip2location.com IP geolookup databases. In order to use this component, you will have to purchase a subscription to the database files from ip2location.com.

<?php

// Load library with the sample file
$ip2loc = new Rych_Ip2Location('./ip2location-database.bin');

// Perform a lookup and get an instance of Rych_Ip2Location_Record
$record = $ip2loc->lookup('70.86.96.219');

echo "{$record->ipAddress}:" . PHP_EOL;
echo "  Latitude: {$record->latitude}" . PHP_EOL;
echo "  Longitude: {$record->longitude}" . PHP_EOL;

Fields available in the record object are:

  • $record->ipAddress
  • $record->ipNumber
  • $record->countryShort
  • $record->countryLong
  • $record->region
  • $record->city
  • $record->isp
  • $record->latitude
  • $record->longitude
  • $record->domain
  • $record->zipCode
  • $record->timeZone
  • $record->netSpeed
  • $record->iddCode
  • $record->areaCode
  • $record->weatherCode
  • $record->weatherName

Any field that is not supported by the given database file will return Rych_Ip2Location::NOT_SUPPORTED.


Sign in to add a comment
Powered by Google Project Hosting