HomePHP Page 3 - Using PHP classes to navigate distributed whois databases
Making sense of it with PHP classes - PHP
Whois services changed radically this year with the introductionof competition at the registrar level in the .com/.net/.orgnamespace and with it the advent of the SRS (Shared Registry System). Find out how to navigate the new whois in your PHP scripts.
Enter Whois2.php, a collection of PHP classes designed to take theguesswork out of all this and provide tools to the webmaster to lookup and process domain name data without having to worry aboutwhere to get it.
The class will be used primarily for querying domain names. While otherquery types exist on some servers, notably contact and host recordson 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'toperate a whois server on port 43, it doesn't belong in this class. .TOand .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.
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 domainwhether it's .com or .cz. Of course due to the differences in outputwe may have to handle those results differently, but getting thedata back from a query should be transparent regardless of what thequery is.
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 serverchanges, or the output of one is different) we want first, that the changedoesn't affect the rest of our operations and second, that it's as easy aspossible to revise our class to cope with it.
We are lazy, and we don't want to code anything twice, so in breakingdown our code into seperate modules for different tasks, those modulesshould inherit anything they need to know that other modules also needto know from a common parent. The parent or base class should be ableto hand off data to other handlers in a seemless, generic way.