FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for CA-Clipper IP locator
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
IP locator
Posted: Sat Jul 08, 2006 08:44 AM

Does anyone has already creates a program tha locates the location of a IP-adress. I have created a program that extract the time,date,url, refer URL and IP-adress of the visitors on a website from a log-report provided by the host of the site.
There are some websites where you can enter a IP-adress, and returns the location (Country, state,city) of that IP adress.
I want to call a site that gives this information and automaticly add it in the database. Does anyone knows such a site. All the sites I found show the result on there site, but how can I extract it, so I can import the data?
Ik know there are some sites that give this information for free if you add a little script on the pages of your site. But it would be nice if I can make it myself, so I can use that info.

Thanks,
Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
IP locator
Posted: Mon Jul 10, 2006 07:47 AM

Marc,

You may use whois.sc/<IP> from the explorer or similar.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
IP locator
Posted: Mon Jul 10, 2006 09:43 AM
Thanks Antonio,

I already found some free database on the net which are updated each month. The have the IP info and locations of that IP. I even found one wich holding the city info but it's a .dat-file than only can be read with API-function you have to call from you program.

This is a example for C, but hou can I implement this?
#include <GeoIP.h>
int main (int argc, char *argv[]) {
  GeoIP * gi;
  gi = GeoIP_new(GEOIP_STANDARD);
  printf("code %s\n",
    GeoIP_country_code_by_name(gi, "yahoo.com"));
}


Regards,
Marc
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
IP locator
Posted: Mon Jul 10, 2006 11:54 AM
Marc,

For Harbour and FWH:
function Main()

   MsgInfo( Country_Code( "yahoo.com" ) )

return nil

#pragma BEGINDUMP

#include <hbapi.h>
#include <GeoIP.h>

HB_FUNC( COUNTRY_CODE )
{ 
  GeoIP * gi = GeoIP_new( GEOIP_STANDARD ); 

  hb_retc( GeoIP_country_code_by_name( gi, hb_parc( 1 ) ) ); 
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
IP locator
Posted: Mon Jul 10, 2006 12:03 PM

Thanks Antonio,

I think I should move from FW to FWH so I can take advantage of the 32bit language 8)

When will be the next FWH release, so I have the latest version?

Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
IP locator
Posted: Fri Jul 14, 2006 10:30 AM

Marc,

We recently published it: FWH 2.7 build June 2006.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
IP locator
Posted: Sat Jul 22, 2006 02:56 AM

Hi Marc,

Have you succeeded in your reqrement ?

If so, can you share the function with me too!.

Thanks and regards

  • Ramesh Babu P
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
IP locator
Posted: Sat Jul 22, 2006 11:50 AM

Ramesh,

Since I still use FW and no FWH, I can't use the function yet (I'am gona move soon to xHarbour). Till thenI use the database that is updated each week. This is a csv-file. I export this file to a DBF-file and use the normal clipper-functions to locate the IP and country info.

Regards,
Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite

Continue the discussion