netcarver Posted December 15, 2014 Share Posted December 15, 2014 A module that uses the db-ip.com IP Geolocation service to fetch geolocation information when given an IP address. I wrote this quickly to help anyone who might be stuck with the #VATMOSS mess and need a way to geo-locate a customer's IP address. You will need to register with db-ip.com in order to get an api key but they have a pretty generous daily-query allowance even for the free key (2000 lookups a day.) Here it is on github. And in the module repository. 13 Link to comment Share on other sites More sharing options...
teppo Posted December 15, 2014 Share Posted December 15, 2014 Looks like this could come in handy. Just recently wrote a snippet to do the same via ipinfo.io, but db-ip.com seems to be at least cheaper. Do they provide HTTPS support, or is it just plain HTTP? Didn't see that in the docs Also, is there particular reason not to use WireHttp? Mostly out of interest; probably won't matter much in real use. 1 Link to comment Share on other sites More sharing options...
Joss Posted December 15, 2014 Share Posted December 15, 2014 I had also noticed this: https://www.maxmind.com/en/opensource 2 Link to comment Share on other sites More sharing options...
netcarver Posted December 15, 2014 Author Share Posted December 15, 2014 @Teppo I tried using db-ip.com with HTTPS and it didn't work. I wonder if they reserve that for one of the paid plans. Also, they had an example client class so I took some inspiration from that when calling through to their service and that's why WireHttp wasn't used. Doesn't mean that couldn't happen in a later version. @Joss Thanks for the link. I had a very quick peek but didn't see the answer to this: do they offer a live restful service or is it a lookup in a self-hosted DB? Link to comment Share on other sites More sharing options...
Joss Posted December 15, 2014 Share Posted December 15, 2014 ummmm Didn't really look - I saw it because it is being used for a woocommerce plugin for the vat moss thingy 1 Link to comment Share on other sites More sharing options...
Joss Posted December 15, 2014 Share Posted December 15, 2014 Okay, this is what is using it - https://wordpress.org/plugins/geoip-detect/ It basically does an automatic update weekly Link to comment Share on other sites More sharing options...
netcarver Posted December 16, 2014 Author Share Posted December 16, 2014 Minor updates pushed. @Joss Thank you for update and the link! I wanted to go for a solution that didn't involve hosting the data myself (either in DB tables or flat files) - but it does leave the site at the mercy of the service's availability. I may investigate a locally-hosted auto-updating version at some point though. 2 Link to comment Share on other sites More sharing options...
teppo Posted December 17, 2014 Share Posted December 17, 2014 Thank you for update and the link! I wanted to go for a solution that didn't involve hosting the data myself (either in DB tables or flat files) - but it does leave the site at the mercy of the service's availability. I may investigate a locally-hosted auto-updating version at some point though. The gelocation snippet I built earlier was purely on the frontend (JS). Didn't want to host (and keep up to date) the IP database locally, and wanted to avoid extra load and delays server-side. Drawback, of course, is that it might not work (sometimes the user just won't get redirected) and the redirect always happens after the page has been loaded (whether the delay is noticeable or not). Whatever way you go, there are still issues to deal with Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now