Skip to content

Querying

Alexey Zilber edited this page Feb 21, 2019 · 4 revisions

How to query the data?

Data querying is based off of this blog post for the all the current supported databases.

In short, you need to convert an IP address to a long, then query via zrevrangebyscore. Like so:

Now we can query Redis using 1746489367 which we got from looking up 8iz.com, which had an IP of 104.25.80.23. We quickly converted that ip on the cli using PHP: echo "<?php echo \"\n\"; echo ip2long('104.25.80.23'); echo \"\n\n\"; ?>" |php

As you can see, querying either the IP2Location or the Software77 database yields identical data using: zrevrangebyscore DB1 1746489367 1 LIMIT 0 1

Clone this wiki locally