address

address

Does An IP Address Provide Useful Tracking Information?

Tuesday, January 18, 2011 - 23:37

An IP address is an address for a computer on the Internet. The usual example used is of a web server that can be accessed via a URL that is translated behind the scenes into an IP address, but IP addresses can be used to find any computer on the Internet.

Category: 

PHP IP To Location

Monday, March 1, 2010 - 23:22

Converting an IP address into some useful location information can be useful if you want to find out where sites are hosted or customise content to users depending on their location.

All this code is freely available over at github.

There are several ways to do this, all of which have their advantages and disadvantages, but sticking with one can cause rewriting a lot of code in the future. So rather than pick one and stick with it I decided to use dependency injection to allow different classes to be used that convert IP addresses to locations in different ways. The first task is to create an abstract class that will be used to construct the rest of the IP location classes. Each class that extends this abstract class will contain a method called getIpLocation() that will convert an IP address into a location, and a method that will update the data source for the location lookup. Rather than lump all of the classes into a single directory I have created a directory called Service, into which all of the different classes that lookup IP addresses will be kept.

Category: 

Blocking Multiple IP Addresses With PHP

Tuesday, May 20, 2008 - 09:32

It is sometimes necessary to block people from using your site, dependent on their IP address. A users IP address can be detected by PHP using the $_SERVER superglobal and the parameter REMOTE_ADDR.

Category: