Find user location (Please help me fix below or suggest any other way)

487 views Asked by At

Hopefully, some one can help me with this issue. I am trying to implement a global site and hence was looking for a way to detect user location. I do not want to use any ip2location webservice or download a database or ask for user to "share location".

Anyways, I found this project. I implemented it , it detects my location correctly (US). However for my friend in Germany it is returning an empty string for Country.

http://javainetlocator.sourceforge.net/. I am using jar file from here.

I am using CF 11 and my code is on

http://roomdu.com/geolocator/

PLEASE SUGGEST ME

1

There are 1 answers

1
Codezilla On BEST ANSWER

Some German IPs are not in the IP database provided with InetAddressLocator. You can see this by running it in interactive mode via command line.

Codemans-MacBook:ColdFusionMX-geoLocator-2.23 Codeman$ java -jar InetAddressLocator.jar

  InetAddressLocator - Java country lookup.
  -----------------------------------------
  Copyright (C) 2003-05 Nigel Wetters Gourlay and Paul Hastings
  InetAddressLocator comes with ABSOLUTELY NO WARRANTY.
  This is free software, and you are welcome to redistribute
  it under the GNU General Public License.

  Running benchmark. Please be patient...
    Speed: 1260307 ops/sec
           (61% of address space is allocated)

  Locating localhost
    Host: /192.168.15.238
    Country: Unknown (private network)

  enter host ('q' to quit) > 5.199.139.54
    Host: /5.199.139.54
    Country: Unknown