Bringing Location to the Internet

PHP Module

This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code and weather station name that any IP address or host name originates from. It has been optimized for speed and memory utilization. Developers can use the API to query all IP2Location™ binary databases for applications supporting PHP.

Download IP2Location PHP Module (483.26 kB) Version: 4.11

 

Installation
  1. Download and unzip and package.
    ip2location-php-x.xx.zip

 

Sample Codes
<?php

require_once('ip2location.class.php');
$ip = new ip2location;
$ip->open('./databases/IP-COUNTRY-SAMPLE.BIN');
$record = $ip->getAll('35.1.1.1');

echo 'IP Address: ' . $record->ipAddress;
echo 'IP Number: ' . $record->ipNumber;
echo 'Country Short: ' . $record->countryShort;
echo 'Country Long: ' . $record->countryLong;
echo 'Region: ' . $record->region;
echo 'City: ' . $record->city;
echo 'ISP/Organisation: ' . $record->isp;
echo 'Latitude: ' . $record->latitude;
echo 'Longitude: ' . $record->longitude;
echo 'Domain: ' . $record->domain;
echo 'ZIP Code: ' . $record->zipCode;
echo 'Time Zone: ' . $record->timeZone;
echo 'Net Speed: ' . $record->netSpeed;
echo 'IDD Code: ' . $record->iddCode;
echo 'Area Code: ' . $record->areaCode;
echo 'Weather Station Code: ' . $record->weatherStationCode;
echo 'Weather Station Name: ' . $record->areaCode;
echo 'MCC: ' . $record->mcc;
echo 'MNC: ' . $record->mnc;
echo 'Mobile Brand: ' . $record->mobileBrand;

?>

 

Sample Database (BIN)

Evaluation version of the database file having limited range of IP address information. You can query all IP addresses from 0.0.0.0 to 99.255.255.255 only.