Question

how can i query the geoip database using php?

I have apache2 with mod_geoip2 installed and the pecl extension geoip PHP 5.3.

i want to search the country of the ip address i have as a parameter, not to query my own ip address.

thanks

Was it helpful?

Solution

I suppose the geoip_country_code_by_name function could do the trick : it takes a hostname or IP address as a parameter, and returns the corresponding country-code.

If you pass the IP address you have for that parameter (and not your own), it should do what you're asking for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top