PHP
  Home arrow PHP arrow Building an IP-to-Country Mapping Application with PHP
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Building an IP-to-Country Mapping Application with PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2009-02-03


    Table of Contents:
  • Building an IP-to-Country Mapping Application with PHP
  • Start building an IP-to-country PHP application
  • Transferring the data of the IP-to-country database to the MySQL table
  • Importing records of the IP-to-country database to the MySQL table

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Building an IP-to-Country Mapping Application with PHP
    ( Page 1 of 4 )

    If you have content in several different languages, your visitors probably speak several different languages as well. Wouldn't it be nice to serve them content from your site in their native language, based on the country from which they hail? You can, even if you're a small company, with an application that tells you a visitor's country based on their IP address. This four-part article series will show you how to build the application and incorporate it into your web site.

    Introduction

    Due to the web’s constant evolution, and more specifically, because of the need to get more traffic, it’s now common to see web sites delivering their contents in different languages, depending on the countries from which they’re being accessed.

    Google, Yahoo, and Hotmail, to cite a few, are good examples of how big companies implement this feature to offer a greater level of customization to their users all over the world. Even PHP’s official web site gives visitors the choice to read the PHP manual using their native languages, which has contributed to expanding its utilization worldwide.

    While it is easy for big web players, like the ones mentioned above, to provide their services through a multi-lingual platform, for small and medium-scaled web sites, implementing this feature can be a more complex and challenging task.

    Not all is lost in cases like these. Actually, building a small web site that will offer support for several languages might be easier than you think, thanks to the existence of a few IP-to-country mapping databases, which can be freely used during the development of a particular web project.

    By way of a mapping database, it’s possible to build an IP-to-country application very easily. Such an application can be utilized, for instance, for creating a web site that delivers its contents in distinct languages according to the countries from which visitors are coming. 

    Currently, there are a few good IP-to-country lookup databases available on the web that can be accessed and used for free, but in this particular tutorial I’m going to pick the one provided by Webnet77 (http://software77.net/cgi-bin/ip-country/geo-ip.pl). It contains more than 87,600 records, which permit you to map over 3,200,000,000 IP addresses to their corresponding countries. That’s a lot of information and hard work!

    In summary, in this group of articles, I’ll be demonstrating how to use the aforementioned database to build an IP-to-country lookup application with PHP, which can be incorporated into any existing web site with minor hassles.

    So, want to learn how to spice up you own web site with neat geo-IP location capabilities? Then start reading now!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek