Aside from coding you will need to subscribe to a service that provide the information. I haven't used any paid services myself but I would suggest something like geobytes.com as their info looks pretty complete. You could start with a free service like hostip.info but the information is basic, not always 100% correct and sometimes missing ... Either way you will need to get the browser IP address and then do the lookup: $mybrowser = "http://api.hostip.info/get_html.php?ip=" . $_SERVER['REMOTE_ADDR']; $mygeoinfo = file_get_contents($mybrowser); echo $mygeoinfo; PHP:
I use the free look up services of geobytes.com. As mentioned you will need to acquire the visitor's IP. In order to keep my script from linking with the service so much, I slowly build up my own data base which is checked against first before finding any information not in the data base. Good Luck! Sam ;
Hi Guys, thanks for the reply. Client do not want a free service. At this moment, only country is enough. I found a latest database for converting IP to country. I like their mechanism. http://software77.net/ Thanks
I know a good website that provide free script to get the country, it don't use a database, just some files and the installation is very easy, 20 lines of scipts, but I can't post a link here, I will post it when I will have more than 10 posts.
Did you look at GeoIP that I have mentioned in my last post? If you want to pay them, they will definetly accept it with thanks. They have a paid service too, and you will get frequent updates as well.
There is complete example in PHP on my site. Easy to install & integrate into your PHP pages. Just 2 minutes to finish your work.