tags:

views:

114

answers:

3

hi all

I want to use on my site a script that shows the user's country code. I know about maxmind.com's GeoIP PHP API, but I can't install the mod_geoip (not my own server) :(

A: 

Use the browser language setting, instead. Nothing more annoying than being on vacation/business in a foreign country and getting the wrong language because it's assuming anyone from that IP speaks that language.

  $language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
ceejayoz
A: 

this is a bad solution - but you can create a service on another server which you can control and have it publish a method that gets the user ip , do the work, and return the answer to the current server. also - most php shared server has a way to change php.ini setting for a single website, check with the hosting company.

Dani
+1  A: 

Apache mod_geoip is an Apache module, not a PHP-specific library. There are PECL bindings for GeoIP that can be used instead of mod_geoip, but these probably also require access to your server configuration. However, there exists also a pure PHP module that can easily be inserted into an existing app (does not require either PECL bindings or mod_geoip) found here.

Ramon
i'll try it, thanks (let u know if it works)
Remus Rigo