Recently I’ve been doing some updates to the Fraud Monitor extension for Easy Digital Downloads which helps store owners avoid costly charge-back fees from fraudulent credit card purchases. The most recent feature is one that verifies the IP address that is downloading the files is in a country not on the blacklist.

When writing this feature I found out that most local hosts (used in development) use either or ::1 as the ‘IP Address’ of the local computer making a request. Even in setups with vagrant and other situations a private IP is what is reveled as the IP making the purchase. The problem is, these IPs are not query-able in tools that do GeoIP lookups, to determine which country, state, or even city an IP address is registered in. This is a key feature of a fraud detection tool. For this reason, I felt it necessary to write a little plugin that does a lookup of my externally facing IP (assigned by my Internet Service Provider) and use IT as my $_SERVER['REMOTE_ADDR'].

By doing this, now when I make purchase in Easy Digital Downloads (in my local development environment), my IP address will be one that can be run through Geo IP lookups and WHOIS requests, allowing me to develop tools based on these types of services.

I’ve built a little single file plugin for WordPress to use on your local host during development that checks the external IP once per hour to use it instead of your ‘local ip’.

Below, you can download a single file plugin to install on your local WordPress site, allowing you to have the same freedoms to do GeoIP lookups in your WordPress projects.

The code looks like this:

Post Promoter Pro

Posted by Chris Klosowski

Hi, I'm Chris Klosowski. Currently I am a Lead Developer of Easy Digital Downloads, where we build the easiest way to sell digital products with WordPress. I am also the person behind Post Promoter Pro, the most effective way to promote your WordPress Content.

Leave a reply

Your email address will not be published. Required fields are marked *