<?php function whois_query($domain) { // fix the domain name: $domain = strtolower(trim($domain)); $domain = preg_replace('#^http://#i', '', $domain); $domain = preg_replace('#^www.#i', '', $domain); $domain = explode('/', $domain); $domain = trim($domain[0]); // split the TLD from domain name $_domain = explode('.', $domain); $lst = count($_domain)-1; $ext = $_domain[$lst]; // You find resources and lists // like these on wikipedia: // // http://de.wikipedia.org/wiki/Whois // $servers = array( 'ac' => 'whois.nic.ac', 'ae' => 'whois.uaenic.ae', 'aero' => 'whois.information.aero', 'at' => 'whois.ripe.net', 'au' => 'whois.aunic.net', 'be' => 'whois.dns.be', 'bg' => 'whois.ripe.net', 'biz' => 'whois.neulevel.biz', 'br' => 'whois.registro.br', 'bz' => 'whois.belizenic.bz', 'ca' => 'whois.cira.ca', 'cc' => 'whois.nic.cc', 'ch' => 'whois.nic.ch', 'cl' => 'whois.nic.cl', 'cn' => 'whois.cnnic.net.cn', 'com' => 'whois.internic.net', 'coop' => 'whois.nic.coop', 'cz' => 'whois.nic.cz', 'de' => 'whois.nic.de', 'edu' => 'whois.internic.net', 'fr' => 'whois.nic.fr', 'gov' => 'whois.nic.gov', 'hu' => 'whois.nic.hu', 'ie' => 'whois.domainregistry.ie', 'il' => 'whois.isoc.org.il', 'in' => 'whois.ncst.ernet.in', 'info' => 'whois.nic.info', 'int' => 'whois.iana.org', 'ir' => 'whois.nic.ir', 'mc' => 'whois.ripe.net', 'mil' => 'rs.internic.net', 'name' => 'whois.nic.name', 'net' => 'whois.internic.net', 'nl' => 'whois.domain-registry.nl' 'org' => 'whois.pir.org', 'ru' => 'whois.ripn.net', 'to' => 'whois.tonic.to', 'tv' => 'whois.tv', 'us' => 'whois.nic.us', ); if (!isset($servers[$ext]) || !in_array($ext, $servers)) { die('Error: No matching nic server found!'); } $nic_server = $servers[$ext]; $output = ''; // connect to whois server: if ($conn = fsockopen ($nic_server, 43)) { fputs($conn, $domain."rn"); while(!feof($conn)) { $output .= fgets($conn, 128); } fclose($conn); } else { die('Error: Could not connect to ' . $nic_server . '!'); } return $output; } ?>
رتبه موضوع:
Whois با PHP
|
05-03-1394، 08:01 ب.ظ
تشکر شده توسط: php
|
|
کاربران در حال بازدید این موضوع: 1 مهمان