PHP: Domain Sorgulama Uygulaması (Whois Search)

php domain whois

Yeni bir proje için en temel öğe uygun domain bulabilmektir.  Bu uygulamamızda yerel sunucunuzda dilediğiniz domainin whois kayıtlarını sorgulama olayını inceleyeceğiz.

Bu uygulama için class.whois.php PHP sınıfını kullanıyoruz.

index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
$domain=$_GET['domain'];
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<title>< <?=$domain?> > Domain arama</title>
</head>

<body>

<h2>Serpito Domain Whois Sorgulama aracı</h2>
<div style="width:100%px; height:50px; background-color:#E3E3DD; padding-top:5px; margin-top:10px;" align="center">
 <form method="get" enctype="application/x-www-form-urlencoded">
<input type="text" value="<?=$domain?>" style="height:24px; padding-left:4px; color:#7E703A; padding-top:5px; font-weight:bold; width:200px;" name="domain" />
 </form> <code>Örnek: serpito.com , google.com</code>
 </div>
<?php
if(isset($_GET['domain'])){

function getwhois($domain, $tld)
 {
 require_once("class.whois.php");

 $whois = new Whois();

 if( !$whois->ValidDomain($domain.'.'.$tld) ){
 return 'Sorry, the domain is not valid or not supported.';
 }

 if( $whois->Lookup($domain.'.'.$tld) )
 {
 return $whois->GetData(1);
 }else{
 return 'Sorry, an error occurred.';
 }
 }

 $domain = trim($_REQUEST['domain']);

 $dot = strpos($domain, '.');
 $sld = substr($domain, 0, $dot);
 $tld = substr($domain, $dot+1);

 $whois = getwhois($sld, $tld);
 ?>
 <div align="center" style="font-weight:bold; color:#42554E;">
 <?php
 echo "<pre>";
 echo $whois;
 echo "</pre>";

 ?>
 </div>
 <?php
}
?>
</body>
</html>

Uygulamanın çalışır demosunu incelemek için tıklayınız.

Uygulama dosyalarını zip şeklinde indirmek için tıklayınız.

Both comments and pings are currently closed.

Comments are closed.


-- Dumlupinar Universitesi Bilişim Kulübü