Using PHP classes to navigate distributed whois databases - Making sense of it with PHP classes (
Page 3 of 7 )
Enter Whois2.php, a collection of PHP classes designed to take the
guesswork out of all this and provide tools to the webmaster to
lookup and process domain name data without having to worry about
where to get it.
Assumptions:
The class will be used primarily for querying domain names. While other
query types exist on some servers, notably contact and host records
on the Network Solutions' server, most simply support domain name lookups.
If we want to do another query type, we'll see that the class still provides
us with methods of doing so.
Web whois databases are not supported. If a given TLD's registry doesn't
operate a whois server on port 43, it doesn't belong in this class. .TO
and .FM for example, only offer whois lookups through a web interface,
and as such, there is no method to lookup .to or .fm domains here.
Objectives:
portable
We want to make the class as portable as possible across as much of the
namespace as possible. This means we want to create a class in which
we don't have to do anything different in our code to lookup a domain
whether it's .com or .cz. Of course due to the differences in output
we may have to handle those results differently, but getting the
data back from a query should be transparent regardless of what the
query is.
modular
We want to be able to break tasks down to smaller, managable sub-tasks.
And if part of our landscape changes (i.e. the address of a whois server
changes, or the output of one is different) we want first, that the change
doesn't affect the rest of our operations and second, that it's as easy as
possible to revise our class to cope with it.
object oriented
We are lazy, and we don't want to code anything twice, so in breaking
down our code into seperate modules for different tasks, those modules
should inherit anything they need to know that other modules also need
to know from a common parent. The parent or base class should be able
to hand off data to other handlers in a seemless, generic way.