ufk
ufk

Reputation: 32144

mod_geoip2 and php pecl-geoip: how can i query by ip address?

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

Upvotes: 0

Views: 1040

Answers (1)

Pascal MARTIN
Pascal MARTIN

Reputation: 401182

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.

Upvotes: 1

Related Questions