Webnet77 Christian web host

Hosting Packages

Up to 40 GB storage!
Up to 200GB Traffic!


web hosting

IP to Country Database Interface module

  More Perl Scripts

The zipped archive (bottom of page) contains several versions of simple scripts you can use to run on your server which uses our IP to country database flat file to lookup the country of origin of an IP address. Scripts are written in PHP and Perl. and most do something similar to what you see below although some are designed to work with MySQL data as well.

Geo Location or GeoIP (also called geo targeting) databases, have many applications. The include the following:

  • Real Time Country Geo-Location
  • Web Server Log analysis
  • Creation of Location Aware Content such as language, currency, etc.
  • Fraud Detection, Credit Card Fraud vetting etc.
  • On-line campaigns such as targeted Banner Ads
  • Digital Rights Management such as music or film distribution
  • Auto country detection for rapid form entry such as country, currency, language.
  • Filter web access on basis of originating country
  • Spam mail Filtering
  • Use your imagination ...

Version 1.1.1 November 2005

Enter an IP address like so:, and the script will produce the following output:

IP Address
Country Code KR
Country KOR
Allocated Aug-27-1999
Registry APNIC
Net block -
OCTAL 32311140000 - 32311157777
Numeric 3,542,401,024 - 3,542,409,215
Hosts in block 8,192


Server and Module Requirements

It should work on any flavor *NIX server with a working Perl install. The only modules required are the 'strict' and 'cgi' modules  which should already be on your server.
Skill Level Required:


If you have never installed a script before, you may find this above you.


Installation is really easy and there are no additional files required except for the actual data file which you download from here (or you can use someone else's provided the format is the same)

Uploading instructions, setting of parameters and variables are all documented below. Enjoy!

1) Make sure the first line of the script points to Perl for your server. The default is:


It can also be #!/usr/local/bin/perl on some servers.

2) Upload the script to a web accessible directory on your server that can execute CGI scripts. For example the cgi-bin directory on your website.

3) Make sure you upload the script in ASCII mode or it won't work.

4) CHMOD it to 755.

5) Unzip the file you downloaded from here and upload it to the same directory as the script. If you call it 'IpToCountry.csv' on your server (Case Sensitive!!) you won't need to change anything in the Perl code.

6) There are only 3 variables you worth mentioning in the code you can change:

my $geofile = 'IpToCountry.csv';

The name of the data file. If you put it elsewhere on your server, be sure to include the full path here.

my $date_delimiter = '-';

The symbol used between the parts of the date

my $date_format = 'mmm-dd-yyyy';

The display format of the date.

7) Don't forget to update your database form time to time by downloading the latest data file.


Terms of Supply

Software is supplied with absolutely no warranty at all. If it breaks your server it is not our problem.

Limited help is available at the forum only. We do not provide help for this product via email.

Download zip file [DOWNLOAD]


Copyright 2002- Webnet77.com. All Rights reserved.