Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

free whois script

Status
Not open for further replies.

Admin

Administrator
Staff member
Joined
Jun 14, 2004
Posts
11,076
Reaction score
962
If anyone is looking to make thier own WHOIS script page, this will give you a head start (requires PHP support from your web hosting):

Code:
<html>
< head>
< title>PHP WHOIS</title>
< meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
< /head>

<body>
< form name="form1" method="post" action="test.php">
<p>Enter Domain: 
<input name="domain" type="text" id="domain">
< /p>
<p>
<input type="submit" name="Submit" value="Check Whois">
< /p>
< /form>
< ?php
if(strlen($_POST['domain']) > 0){

// Create Whois Server Array
$server['nic'] = "whois.nic.uk:No match for";
$server['crsnic'] = "whois.crsnic.net:No match for";

// Create Extension Array
$domainInfo['.co.uk'] = "nic";
$domainInfo['.org.uk'] = "nic";
$domainInfo['.ltd.uk'] = "nic";
$domainInfo['.plc.uk'] = "nic";
$domainInfo['.com'] = "crsnic";
$domainInfo['.net'] = "crsnic";
$domainInfo['.org'] = "crsnic";

// Separate Domain and Extension
$fullDomain = $_POST['domain'];
$parts = explode(".",$fullDomain);
$domain = $parts[0];
$extension = str_replace($domain,"",$fullDomain);

// Find Whois Server and Text to Match
$tempServer = $domainInfo[$extension];
$whoisDetails = $server[$tempServer];
$splitWhois = explode(":",$whoisDetails);
$whoisServer = $splitWhois[0];
$textToMatch = $splitWhois[1];

// Query WHOIS Server for Domain
$port = 43;
$domainName = $domain . $extension . "\n";
$fp = fsockopen($whoisServer,43);
fputs($fp, $domainName);
while (!feof($fp))
$whoisRecord .= fgets($fp,128);
fclose($fp);
$whoisRecord = str_replace("\n","<br>",$whoisRecord);

// Check Whether Domain is Registered or not
if(strstr($whoisRecord, $textToMatch) != FALSE){
$registered = 0;
} else {
$registered = 1;
}

// Output Results
if($registered==0){
echo $domain . $extension . " is not registered.";
} else {
echo $domain . $extension . " is registered. WHOIS Details:";
echo "<br><br>";
echo $whoisRecord;
}
}
?>
< /body>
< /html>
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom