Пример #1
0
function GetDomainInfo($q, $orig_name)
{
    $server = 'whois.r01.ru';
    //Whois server
    $whois = new Net_Whois();
    $data = $whois->query($q, $server);
    //echo($data) . "<br>\n"; //Выводит ответ в сыром виде, можно включить для отладки
    //Ниже вычленяем необходимую информацию о домене
    $reg_till_label = 'reg-till:';
    $created_label = 'created:';
    $changed_label = 'changed:';
    $free_date_label = 'free-date:';
    $registrar_label = 'registrar:';
    preg_match('/' . preg_quote($reg_till_label) . '(.*?)' . preg_quote($created_label) . '/is', $data, $reg_till);
    preg_match('/' . preg_quote($created_label) . '(.*?)' . preg_quote($changed_label) . '/is', $data, $created);
    preg_match('/' . preg_quote($changed_label) . '(.*?)' . preg_quote($free_date_label) . '/is', $data, $changed);
    preg_match('/' . preg_quote($free_date_label) . '(.*?)' . preg_quote($registrar_label) . '/is', $data, $free_date);
    $reg_till = $reg_till[1];
    $created = $created[1];
    $changed = $changed[1];
    $free_date = $free_date[1];
    //Если домен кириллический, передаем в таблицу его имя на кириллице
    if ($orig_name) {
        FormatTableRow($orig_name, $created, $changed, $reg_till, $free_date);
    } else {
        FormatTableRow($q, $created, $changed, $reg_till, $free_date);
    }
}
Пример #2
0
 /**
  * Get file using HTTP request (grabbed from drupal 5.1)
  */
 function get_whois_info($url, $server = "")
 {
     if (empty($url)) {
         return false;
     }
     $tmp = parse_url(trim($url));
     if (empty($tmp["host"])) {
         return false;
     }
     $url = trim($tmp["host"]);
     if (substr($url, 0, 4) == "www.") {
         $url = substr($url, 4);
     }
     require_once "Net/Whois.php";
     $whois = new Net_Whois();
     $data = $whois->query($url);
     // Cut non-needed info
     $data = preg_replace("/NOTICE: The expiration date .+?(Registrant:)/ims", "\\1", $data, 1);
     $data = preg_replace("/.+?(   Domain Name: )/ims", "\\1", $data, 1);
     $data = preg_replace("/([ ]{2,})/i", " ", str_replace(["\t", "\r"], [" ", "\n"], trim($data)));
     $data = preg_replace("/([\n]{2,})/i", "\n", $data);
     return $data;
 }
Пример #3
0
<?php

require 'Net/Whois.php';
$query = 'oreilly.com';
$iana_server = 'whois.iana.org';
$whois = new Net_Whois();
$iana_data = $whois->query($query, $iana_server);
preg_match('/^whois:\\s+(.+)$/m', $iana_data, $matches);
$tld_whois_server = $matches[1];
$tld_data = $whois->query($query, $tld_whois_server);
print $tld_data;
Пример #4
0
<?php

require 'Net/Whois.php';
$server = 'whois.godaddy.com';
$query = 'oreilly.com';
$whois = new Net_Whois();
$data = $whois->query($query, $server);
Пример #5
0
function domainWhoisInfo($URL)
{
    $inf = parse_url($URL);
    if ($inf) {
        $inf = explode('.', $inf[host]);
        $domain = $inf[sizeof($inf) - 2] . '.' . $inf[sizeof($inf) - 1];
    }
    if ($domain) {
        global $_CONF;
        include_once $_CONF[root_dir] . $_CONF[pear_dir] . "Whois.php";
        $server = $_CONF[whois_server];
        $whois = new Net_Whois();
        $data = $whois->query($domain, $server);
        /*
          preg_match('/Whois server: (\S+)/i',$data,$whois_data);
          if (!empty($whois_data[1])) $server=$whois_data[1];
          mydump($server);
          $data = $whois->query($domain, $server);
          mydump($data);
        */
        preg_match('/creation date: (\\S+)/i', $data, $whois_data);
        $ret[registrationDate] = $whois_data[1];
    }
    return $ret;
}