IP to GeoLocation

Dani

Well-Known Member
#1
Since LS uses the DB why not have a function to call it from php so that I can get the country using users IP's

echo LS_ip_to_get('11.22.33.44');

Since the lite version of geo isn't 100% it would be nice to be able to check if some users have an IP that resolves to a faulty country to prevent them from getting blocked.
 

mistwang

LiteSpeed Staff
#2
It has been set in the SERVER[] variables already, like mod_geoip does.

SERVER["GEOIP_COUNTRY"], etc. please check the mod_geoip manual for the name of environment variables.
 

Dani

Well-Known Member
#3
It has been set in the SERVER[] variables already, like mod_geoip does.

SERVER["GEOIP_COUNTRY"], etc. please check the mod_geoip manual for the name of environment variables.

Yea I see the two _SERVER vars but they only reflect to 'my' ip, or ip that is currently calling the php. I was wondering if it's possible to manually give it an ip and get the country in return.

e.g.

echo geoip_country_code_by_addr($gi, "24.24.24.24");

taken from: http://www.maxmind.com/download/geoip/api/php/README


without installing the mod and having to include the geoip as LS already does this nicely for me.
 

Dani

Well-Known Member
#5
You should use the geoip's PHP module instead, we do not want to reinvent the wheel in this regard. :)
heh understood, just thought LS had something other than the 2 server vars in it but since its _SERVER i can't do anything there anyway. It's a tad late to be thinking logical hehe :p thx mistwang
 
Top