Location: PHPKode > scripts > domain > Domain/index.php
<?php
if(isset($_REQUEST['domain'])){
	$domain = strip_tags($_REQUEST['domain']);
	$error = false;
	
	if (preg_match('/[^a-z0-9.]/i', $domain)) $error = "Invalid characters found in the entered domain.";
	
	$ch = curl_init();
	$timeout = 5;
	unset($bhawani);
	curl_setopt($ch,CURLOPT_URL,"http://new.whois.net/whois/".$domain);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
	$data = curl_exec($ch);
	curl_close($ch);
	
	if(empty($data)) $error = "Can not connect to WHOIS database. Please make sure this host has CURL enabled.";
	
	if(stristr($data, "Registrar:")!=false){
		$bhawani = explode("Registrar:",$data,2);
		$bhawani = $bhawani[1];
		$bhawani = explode("Status:",$bhawani,2);
		$bhawani = $bhawani[0];
		if(stristr($bhawani,"Whois Server:")!=false){
			$bhawani = explode("Whois Server:",$bhawani,2);
			$bhawani = $bhawani[0];
			$bhawani = trim($bhawani);
		}
	}
	elseif(stristr($data, "Registrar Name:")!=false){
		$bhawani = explode("Registrar Name:",$data,2);
		$bhawani = $bhawani[1];
		$bhawani = explode("Registrar Whois:",$bhawani,2);
		$bhawani = $bhawani[0];
	}
	else{
		$bhawani = "Registrar can't be found";
	}
	
	$bhawani = trim($bhawani);
}
?>

<html>
<head>
	<title>Domain Registrar Finder - BhawaniGarg.com</title>
	
</head>
<body>
<center>
	<div id="wrap">
	<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="GET">
		<p id="title"><a href="<?php echo $_SERVER['PHP_SELF'] ?>"><img src="logo/logo.png"> </a></p>
		<p id="description"><font face="verdana"><b>This little tool will allow you to find the registrar of any domain by checking it's WHOIS information.</p>
		<?php
			if(isset($error) and $error!=false){
				echo $error;
			}
			else{
				if(isset($_REQUEST['domain'])){
					echo "<p id=\"result\">This domain's registrar is: ";
					echo $bhawani;
					echo "</p>";
				}
			}
		?>
		<p><input type="text" name="domain" size="100" style="width:200px;margin-left:auto;margin-right:auto;" value="<?php if(isset($domain)) echo $domain; else echo "google.com" ?>">
		<input type="submit" value="Check"></p>
	</form>
	<p id="footer">Powered by <a href="http://www.bhawanigarg.com" title="A weblog by Bhawani Garg on random stuff, majorly talks about technology, programming,social media,seo,games etc">BhawaniGarg.Com</a> | Licensed under <a href="http://creativecommons.org/licenses/by/3.0/" title="This work is licensed under a Creative Commons Attribution 3.0 Unported License.">CC 3.0</a></p></font></b>
	</div>
	
</body>
</html>
Return current item: domain