IP-Country mapping Database With ISP - Locate Internet Visitors by ip address to country and ISP

Frequently Asked Questions

How often is the database updated?
The database is updated every month. About 1% of the database changes every month.

Are the monthly update a complete set of all entries or only a part of all IP-Address ?
The monthly update are a complete set of all entrie.

How do you dispatch the montly updates? By e-mail, regular mail,downloadable?
Downloadable.

How accurate is your database?
The database is about 98% accurate.

What is the database format?
The database format is known as Comma Separated Values (CSV). All fields are separated by a comma and each individual line is a record by itself.

Would it be possible to receive the database as a mysql dump file instead of the CSV file?
You can receive the database as a mysql dump file instead of the CSV file.

What is the size of the database?
The March 2005 CSV file is 10.38 Megabytes.

What is the definition of each column in the table?

Field Data Type Field Description
Start IP Number unsigned int First IP in netblock, IP Number
End IP Number unsigned int Last IP in netblock, IP Number
Country Code char(2) ISO 3166 Country Code
Country Name varchar(50) The name of the country
ISP NAME varchar(255) Internet Service Provider or company's name

How do I create and import the database into MySQL database?
  1. Create and connect to 'ip2geo' database
    mysql> CREATE DATABASE ip2geo
    mysql> CONNECT ip2geo
  2. Create 'ipisp' table
    mysql> CREATE TABLE IPISP
    --> (
    --> ipFROM INT(10) UNSIGNED ZEROFILL NOT NULL DEFAULT '0000000000',
    --> ipTO INT(10) UNSIGNED ZEROFILL NOT NULL DEFAULT '0000000000',
    --> countryCode CHAR(2) NOT NULL,
    --> countryName VARCHAR(50) NOT NULL,
    --> ipISP VARCHAR(255) NOT NULL,
    --> PRIMARY KEY(ipFROM, ipTO)
    --> );
  3. Import the 'IPISP.csv' database into table 'ipisp'
    mysql> LOAD DATA INFILE "<path>/IPISP.csv" INTO TABLE IPISP FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
How do I convert a IP Address to a IP Number?

IP address (IPV4) is divided into 4 sub-blocks. Each sub-block has a different weight number each powered by 256.
Beginning IP number and Ending IP Number are calcuated as follows:
IP Number = 16777216*w + 65536*x + 256*y + z
where IP Address = w.x.y.z

PHP Function To Convert IP Address to IP Number
-----------------------------------------------
function Dot2LongIP ($IPaddr)
{
if ($IPaddr == "") {
return 0;
} else {
$ips = split ("\.", "$IPaddr");
return ($ips[3] + $ips[2] * 256 + $ips[1] * 65536 + $ips[0]
*16777216); }
}

ASP Function To Convert IP Address to IP Number
-----------------------------------------------
Function Dot2LongIP (ByVal DottedIP)
Dim i, pos
Dim PrevPos, num
If DottedIP = "" Then
Dot2LongIP = 0
Else
For i = 1 To 4
pos = InStr(PrevPos + 1, DottedIP, ".", 1)
If i = 4 Then
pos = Len(DottedIP) + 1
End If
num = Int(Mid(DottedIP, PrevPos + 1, pos - PrevPos - 1))
PrevPos = pos
Dot2LongIP = ((num Mod 256) * (256 ^ (4 - i))) + Dot2LongIP
Next
End If
End Function

The IP address is available from the web server variable "REMOTE_ADDR"?

The IP address is available from the web server variable "REMOTE_ADDR".

  • PHP without Proxy detection
    <? $ipaddress = getenv(REMOTE_ADDR); ?>

  • PHP with Proxy detection
    <?if (getenv(HTTP_X_FORWARDED_FOR)) {
    $ipaddress = getenv(HTTP_X_FORWARDED_FOR);
    } else {
    $ipaddress = getenv(REMOTE_ADDR); }
    ?>

  • ASP without Proxy detection
    <%
    ipaddress = Request.ServerVariables("REMOTE_ADDR")
    %>

  • ASP with Proxy detection
    <%
    ipaddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    if ipaddress = "" then
    ipaddress = Request.ServerVariables("REMOTE_ADDR")
    end if
    %>

  • JSP without Proxy detection
    <%
    String ipaddress = request.getRemoteAddr();
    %>

  • JSP with Proxy detection
    <%
    if (request.getHeader("HTTP_X_FORWARDED_FOR") == null) {
    String ipaddress = request.getRemoteAddr();
    } else {
    String ipaddress = request.getHeader("HTTP_X_FORWARDED_FOR");
    }
    %>

How do I use this database?
First, import this database into your MS-SQL, MS-ACCESS, PL/SQL, MySQL database and etc. Then, write a query to get a recordset.

Example of SQL Query
====================
SELECT [COUNTRY NAME COLUMN] FROM [IP-COUNTRY TABLE] WHERE
[SEARCH IP NO] BETWEEN [IP FROM COLUMN] AND [IP TO COLUMN]

How many IP addresses are in your database? How many countries are included?
Please see our Technical Details page.

Are the monthly update a complete set of all entries or only a part of all IP-Adesses ?
The monthly update are a complete set of all entrie.

How do you dispatch the montly updates? By e-mail, regular mail,downloadable?
Downloadable.

Does IP Address Reveal My Physical Location?

IP Address Location - Find Ip Address with My Lookup Locator
 If you have a question that is not answered here, please e-mail it to techsupport@ip2geo.net.

Copyright ©2001-2010 Jgsoft Associates. All rights reserved.