php dns sorgusu
Php ile dns sorgusu, mevcut dns serverlara php nin network fonkisiyonları içinde yer alan fsockopen ile yapılıyor. mantık şu. bu fonkisiyon, dns server a domain ismini soruyor. serverda cevap veriyor. bu sorgu serverlara 43. portu üzerinden soruluyor.. Örnek
$server = "whois.crsnic.net";
$port = 43;
$domainname = "galibarda.com";
if(($ns = fsockopen($server,$port)) == true)
{
fputs($ns,"$domainname\r\n");
while(!feof($ns))
$cikti= fgets($ns,128);
fclose($ns);
}
echo $cikti;
tabi her dns servera her domain i soramıyoruz. örneğin
crsnic.net servere sadece com-net uzantılı domainlere bakıyor.
Yani com.tr yi bu serverdan sorgulayamayız. Domain ismine göre kullanabileceğimiz
server listesi
<?php $WHOIS_SERVERS = Array( "com" => "whois.crsnic.net", "net" => "whois.crsnic.net", "org" => "whois.publicinterestregistry.net", "edu" => "whois.crsnic.net", "biz" => "whois.neulevel.biz", "info" => "whois.afilias.info", "us" => "whois.nic.us", "uk" => "whois.nic.uk", "ca" => "whois.cira.ca", "de" => "whois.nic.de", "ws" => "whois.nic.ws", "au" => "whois.ausregistry.net.au", "nu" => "whois.nic.nu", "in" => "whois.registry.in", "tel" => "whois.nic.tel", "ie" => "whois.iedr.ie", "tw" => "whois.twnic.net.tw", "tv" => "whois.nic.tv", "ch" => "whois.nic.ch", "eu" => "whois.eu", "it" => "whois.nic.it", "cn" => "whois.cnnic.net.cn", "mobi" => "whois.dotmobiregistry.net", "cc" => "whois.nic.cc", "asia" => "whois.nic.asia", "pro" => "whois.registrypro.pro", "hk" => "whois.hknic.net.hk", "me" => "whois.meregistry.net", "be" => "whois.dns.be", "se" => "whois.nic.se", "ca" => "whois.cira.ca", "nz" => "whois.domainz.net.nz", "nl" => "whois.sidn.nl", "tr" => "whois.nic.tr" );?>