Jump to content

IP Address to Country?


Northern Flame

Recommended Posts

Is there a way to match the users IP address to their country?

or any other way to tell which country the user is in?

I've been looking at the $_SERVER variables but I can't seem to

find anything on getting the country. Any help will be greatly

appreciated!

 

P.S. I want to get the users country so I can display the websites

content in the language of that country.

Link to comment
Share on other sites

oh well you have to pay for that

and I would prefer to make it myself  :)

 

 

would this work?

 

$_SERVER['HTTP_USER_AGENT']

 

I just tried it and I got this as a result:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12

 

so I guess I can just take the en-US part to determine their location and language.

but would that work all the time or is it the same string for this browser no matter where

your location is?

 

-----------------------------------------------------------------------------

 

oh wait never mind, i just tried this on IE and i get this:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; YPC 3.2.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

and form that I cant see anyway to determine their location or language

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.