IP/country mapping of website's visitors

I'm currently looking for ways to automatically identifying my website's visitor's country location through their originating IP address using JavaScript/jQuery.  I'm sure there is a way but I'm not sure how.
snajalmAsked:
Who is Participating?
 
Dave BaldwinFixer of ProblemsCommented:
It looks like they do have a javascript based service.  http://dev.maxmind.com/geoip/javascript
0
 
sivagnanam chandrakanthTechnical LeadCommented:
Just create a php file with the following code:

echo ' [ { "ip" : "$_SERVER['REMOTE_ADDR']" } ]';

and then ping that with get JSON

see this

http://stackoverflow.com/questions/1641868/how-to-get-client-ip-address-using-jquery
0
 
Chris SandriniSenior System EngineerCommented:
Hi

You could make use of the geoplugin api.

http://www.geoplugin.com/quickstart#how_to_geo-localize_your_visitors

For instance

http://www.geoplugin.net/json.gp?ip=<your ip here>&jsoncallback=<suitable javascript function in your source>
0
 
Loganathan NatarajanLAMP DeveloperCommented:
0
 
Dave BaldwinFixer of ProblemsCommented:
I don't think you can do it with just JavaScript/jQuery.  Here's an API I use with PHP on several sites.  http://dev.maxmind.com/geoip/geolite
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.