Alan Adı Sorgulama

<?php
Class AlanAdi{
	var $content;
	var $bilgi;
	function kontrol($adres){
		if (!empty($adres)){
			$a= parse_url($adres);
			if(isset($a["host"])){
				$sunucu=$a["host"];
			}else{
				$sunucu=$adres;
			}
			$url="https://reports.internic.net/cgi/whois?whois_nic=".$sunucu."&type=domain";
			$ch= curl_init($url);
			curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
			curl_setopt($ch,CURLOPT_HEADER,false);
			curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
			curl_setopt($ch,CURLOPT_USERAGENT,"Googlebot/2.1 (+http://www.google.com/bot.html)");
			curl_setopt($ch,CURLOPT_HTTPHEADER,array('Referer: https://www.internic.net/whois.html'));
			$this->content=curl_exec($ch);
			curl_close($ch);
			if(strstr($this->content,"No match for adres")){
				return false;
			}else{
				return true;
			}
		}else{
			return false;
		}
	}
	function bilgi($adres){
			if($this->kontrol($adres)){
				preg_match("/pre>(.*?)</si",$this->content,$cikti);
				return explode("\n",$cikti[1]);
			}
			
		}
}
$w=new AlanAdi;
print_r($w->bilgi("ulusanyazilim.com"));
?>

Çıktısı

Array
(
    [0] => 
    [1] =>    Domain Name: ULUSANYAZILIM.COM
    [2] =>    Registry Domain ID: 1779058037_DOMAIN_COM-VRSN
    [3] =>    Registrar WHOIS Server: whois.ihs.com.tr
    [4] =>    Registrar URL: http://www.ihs.com.tr
    [5] =>    Updated Date: 2018-02-06T22:31:04Z
    [6] =>    Creation Date: 2013-02-08T01:19:52Z
    [7] =>    Registry Expiry Date: 2020-02-08T01:19:52Z
    [8] =>    Registrar: IHS Telekom, Inc.
    [9] =>    Registrar IANA ID: 1091
    [10] =>    Registrar Abuse Contact Email:
    [11] =>    Registrar Abuse Contact Phone:
    [12] =>    Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
    [13] =>    Name Server: NS1.IHSDNSX34.COM
    [14] =>    Name Server: NS2.IHSDNSX34.COM
    [15] =>    DNSSEC: unsigned
    [16] =>    URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
    [17] => >>> Last update of whois database: 2018-06-05T14:35:47Z 
)

 

Dünyanın En Hızlı Alan Adı Sorgulama Sistemi

Demo

http://ulusanyazilim.com/works/domain/

Mantık

<?php 
error_reporting(0);
$url='http://who.is/whois/'.$_POST["sorguc"];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_URL, $url);
$html = curl_exec($ch);
$html =  file_get_contents($url);
@preg_match('#<pre(.*?)pre>#si',$html,$value);	
@preg_match('#queryResponseHeader (.*?)">#si',$html,$sonuc);
if(strlen(strstr($value[1], "No match found")) > 0){
	echo '<div class="alert alert-success" role="alert">'.$_POST["sorguc"].' Uygun.</div>';
}elseif($sonuc[1] != "hidden"){
	echo '<div class="alert alert-danger" role="alert">'.$_POST["sorguc"].' Alınmış.</div>';
}elseif(strlen(strstr($value[1], "No match found")) == 0 ){
	if(strstr($_POST["sorguc"], ".tr")){
		echo '<div class="alert alert-danger" role="alert">'.$_POST["sorguc"].' Alınmış.</div>';
	}else{
		echo '<div class="alert alert-success" role="alert">'.$_POST["sorguc"].' Uygun.</div>';
	}
}else{	
	echo '<div class="alert alert-success" role="alert">'.$_POST["sorguc"].' Uygun.</div>';
}
?>

Adresten Alan Adı Almak

<?php
function urltemizle($url){
$domain=strtolower($url);
$domain= preg_replace(array('~^https?://~si' ,'~[/:#?;%&].*~','~.$~',),'',$domain);
if(preg_match('#^www.(.*)#i',$domain)){$domain=preg_replace('#www.#i','',$domain);}
$domain="http://".$domain;
return $domain;
}

echo urltemizle("http://phpstate.ulusanyazilim.com/index.php");
//Çıktısı phpstate.ulusanyazilim.com

?>