The Files

Sams Whois comprises the following files: (Download from GitHub).

samswhois.class.php

This file contains the main SamsWhois php class that provides all the functionality for whois lookups and caching the results. Whilst you can use this directly from your own scripts, in most cases you can just include the following file instead:

samswhois.inc.php

An include file that handles all the details of using the SamsWhois class, displaying the lookup form and showing the results of each whois lookup. If you want to use the secure code option, this file also automatically handles generating the codes and checking the correct code has been submitted using the following class:

secureimagecode.class.php

A utility php class which contains functions for generating a random code of a specified length as well as generating an image containing this code. The class can generate the code using numbers, upper or lowercase letters, or a combination of all 3. Additional options are included for the paranoid to make it harder to extract the code from the image using character recognition software.

swsecureimage.php

This file just uses the secureimagecode class to output a png image containing the security code to the web browser.

whois-example.php

This file serves as an example of using the samswhois.inc.php file to add a whois lookup to your website. By default, it just uses the basic options but by uncommenting some variables in the file you can turn on whois result caching, secure code usage and other options.

swstyles.css

This file contains the css style definitions used by the samswhois.inc.php file to display the whois lookup form and results. Modifying this file is the simplest way to alter the design of the page.

config.txt

This file contains configuration information for the SamsWhois class about which whois server to use for each tld, as well as options for individual whois servers for parsing the whois data to determine availability, etc. See the file itself for details of the format.