Location: PHPKode > scripts > Whois Lookup > whois-lookup/sample.php
 * @category ServerTools
 * @package Whois
 * @author Peter Schmalfeldt <hide@address.com>
 * @link http://www.manifestinteractive.com

 * Begin Document
## include class

## check for $_POST or $_GET variable called 'domain'
$url = (strlen($_POST['domain'])>0) ? $_POST['domain']:$_GET['domain'];

## if domain is not empty, instantiate Whois object
if(strlen($url)>0) $whois = new Whois($url);

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<title>Whois Lookup</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <form action="<?=$_SERVER['PHP_SELF']?>" method="post" enctype="multipart/form-data" autocomplete="off">
        Domain/IP: <input type="text" name="domain" id="domain" value="<?=$whois->domain?>" style="width: 250px;" spellcheck="false" title="Enter a Domain Name or IP Address." />
        <input type="submit" value="&nbsp;Whois Lookup&nbsp;" title="Perform a Whois Lookup on this Domain Name or IP Address." />
		## provide link to open URL in new window since domain name exists
		if($whois->url && !preg_match("/No match for/i", $whois->data) && !preg_match("/Error:/i", $whois->data))
			echo '<input type="button" value="&nbsp;Open URL&nbsp;" title="Open this URL in a new window." onclick="window.open(\''.$whois->url.'\')" />';
        ## provide link to GoDaddy.com in new window to purchase domain since domain name does not exist
		if(preg_match("/No match for/i", $whois->data))
			echo '<input type="button" value="&nbsp;Order Domain&nbsp;" title="Order this Domain Name with GoDaddy.com." onclick="window.open(\'http://www.godaddy.com/gdshop/registrar/search.asp?domainToCheck='.$whois->domainarray[1].'&tld=.'.strtoupper($whois->domainarray[0]).'&checkAvail=1&ci=12014\')" />';

		## show the results from the whois lookup
			echo '<textarea readonly="readonly" spellcheck="false" style="width: 100%; height: 500px;">'.htmlspecialchars($whois->data).'</textarea>';
Return current item: Whois Lookup