1
iunderwood
UHQ-Geolocate

Crew,

I'm starting work on a geolocation module for XOOPS, which can return an approximate guess as to where a user is based upon a given IP address. There are a number of services and databases available which serve this purpose, but what I am aiming to do is build a single module which I hope to extend to get information from multiple information providers.

Initially, I intend to work with the IP2Location database for country codes only since that's all I can reasonably afford for my own application.

However, if there are any suggestions on what could or should be done with the module, I'd like to hear them.

Thanks in advance!
++I;
Resized Image

2
zyspec
Re: UHQ-Geolocate
  • 2010/12/6 20:32

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


You might think about making a modular architecture that allows different web service plugins so others can extend the module to use the service 'of their choosing'.

You might want to consider http://ipinfodb.com - they have a free web service and they have a rudimentary PHP class available as a starting place.

3
andrey3761
Re: UHQ-Geolocate

Faster will be processed through the PHP Extension Geo IP.
http://www.maxmind.com/app/php

4
iunderwood
Re: UHQ-Geolocate

Zyspec: I'm not exactly sure how to build a truly dynamic architecture for this just yet. However, I am returning an object that will have a structured output that should only get added to as the module further develops.

I've noted IPinfoDB and Maxmind for additional sources of information and will work both of those in. Note that the former is built off the free Maxmind DB and supplemented with other tools.
++I;
Resized Image

5
iunderwood
Re: UHQ-Geolocate

Looking for a little more feedback.

First, regarding using the module, I've got the following written up on its use:

==[ Use ]==

Modules which call out to geolocation services should test that the module is active and installed before using it. This is important because the module has been written with the capability to be disabled if desired through module preferences. (i.e. your provider cries that you use too much CPU or something)

For a full-validation include:

function mymodule_geolocate($ip) {
    global 
$module_handler;
    
    
$uhq_geolocate = &$module_handler->getByDirname('uhq_geolocate');
    if (
is_object($uhq_geolocate)) {
        if (
$uhq_geolocate->getVar('isactive')) {
            require_once 
XOOPS_ROOT_PATH."/modules/uhq_geolocate/class/geolocate.class.php";
            
            
$geoloc = new geolocate;
            
$geoloc->ipin $address;

            
$location $geoloc->locate();
            
            return 
$location;        
        }
    }
    return 
NULL;
}


The location is an object containing five variables: country, region, city, error, result.

Country: The two-letter ISO country code for the IP address submitted.

Region: Region within the country, if supported by your database.

City: City within the country, if supported by your database.

Error: An error number will be returned if there was a problem.
1 = Location disabled by module option
2 = Invalid IP address

Result: Object output from whatever class is used to query for the location. Good if you need to use specific results not directly supported by the module.

=====

Next up, I'm not quite sure what kinds of things would be good in the admin interface. As far as the commercial DBs go, I do intend to make it possible to update from within XOOPS, but am not necessarily committed to that for initial release.

Also, I'd like to know if anyone has a good place for an international flag set which I'd like to use within the context of a simple demo block which can be put on a site. I do have a tiny set which is good for single lines of text, but am looking for something bigger.

While I know the DBs can provide a ton more data than my object outputs at the moment, I'm looking to get a good base out there to start which can be extended upon later.
++I;
Resized Image

6
iunderwood
Re: UHQ-Geolocate

The module is moving along and has most of its shine and polish in place for a 0.9 release. The cheesy demo block can be seen on my XOOPS site:

http://xoops.underwood-hq.org

It's results are powered by the IP2Location DB1 binary database. More providers will be added to the module soon, but I do want to get this module out by Christmas.
++I;
Resized Image

7
Mamba
Re: UHQ-Geolocate
  • 2010/12/16 7:12

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Looking good!

We always like Christmas gifts
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

8
iunderwood
Re: UHQ-Geolocate

And to sweeten the pot, I just put in IPInfoDB, which users can register for and use for free w/ their web API. :)

Just needs more polish and some verbosity in the documentation.
++I;
Resized Image

Login

Who's Online

199 user(s) are online (98 user(s) are browsing Support Forums)


Members: 0


Guests: 199


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits