chaizhenhua / ngx-ip2location

Nginx IP2Location Module
BSD 2-Clause "Simplified" License
23 stars 19 forks source link

How to query info from giving IP? #8

Open hcaihao opened 8 years ago

hcaihao commented 8 years ago

IP write in code, not by user request.

hcaihao commented 8 years ago

such as php does:

$db = new IP2LocationDatabase( 'db/IP2LOCATION-LITE-DB11.BIN', IP2LocationDatabase::FILE_IO); $your_public_ip = '8.8.8.8'; $records = $db->lookup($your_public_ip, IP2LocationDatabase::ALL); ...

chaizhenhua commented 8 years ago

did you mean get location by ip address through nginx config script?

hcaihao commented 8 years ago

No, I have many ip addresses to query, I need get infos form lua code.

local ips = {"ip1", "ip2", "ip3"};

for k, v in ipairs(ips) do get_country(ips[k]) get_city(ips[k]) ... end

How to implement get_country & get_city function?

chaizhenhua commented 7 years ago

hi @hcaihao, sorry for the delay. can you show me your nginx config and lua script. i just do not know how to reproduce this.