diff --git a/Changes.md b/Changes.md index 9480016..34efc2c 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,5 @@ +2009/12/29 + - released version 4.2.0 - added handler for .tel - new easy_parser funtion applied to many handlers - fixes for several handlers diff --git a/src/whois.client.php b/src/whois.client.php index 93ebb8a..daab83c 100755 --- a/src/whois.client.php +++ b/src/whois.client.php @@ -60,7 +60,7 @@ class WhoisClient { ); // This release of the package - var $CODE_VERSION = '4.1.3'; + var $CODE_VERSION = '4.2.0'; // Full code and data version string (e.g. 'Whois2.php v3.01:16') var $VERSION; @@ -204,8 +204,8 @@ class WhoisClient { $output = explode("\n", $raw); - // Drop empty last line (if it's empty! - saleck) - if (empty($output[count($output)-1])) + // Drop empty last line (if it's empty! - saleck) + if (empty($output[count($output)-1])) unset($output[count($output)-1]); } @@ -472,15 +472,15 @@ class WhoisClient { $this->Query['server'] = $wserver = $result['regyinfo']['whois']; - $subresult = $this->GetRawData($query); - - if (!empty($subresult)) + $subresult = $this->GetRawData($query); + + if (!empty($subresult)) { $result = $this->set_whois_info($result); - $result['rawdata'] = $subresult; + $result['rawdata'] = $subresult; - if (isset($this->WHOIS_GTLD_HANDLER[$wserver])) - $this->Query['handler'] = $this->WHOIS_GTLD_HANDLER[$wserver]; + if (isset($this->WHOIS_GTLD_HANDLER[$wserver])) + $this->Query['handler'] = $this->WHOIS_GTLD_HANDLER[$wserver]; else { $parts = explode('.',$wserver); @@ -489,97 +489,97 @@ class WhoisClient { if (($fp = @fopen('whois.gtld.'.$hname.'.php', 'r', 1)) and fclose($fp)) $this->Query['handler'] = $hname; } - - if (!empty($this->Query['handler'])) - { - $this->Query['file'] = sprintf('whois.gtld.%s.php', $this->Query['handler']); - $regrinfo = $this->Process($subresult); //$result['rawdata']); + + if (!empty($this->Query['handler'])) + { + $this->Query['file'] = sprintf('whois.gtld.%s.php', $this->Query['handler']); + $regrinfo = $this->Process($subresult); //$result['rawdata']); $result['regrinfo'] = $this->merge_results($result['regrinfo'], $regrinfo); //$result['rawdata'] = $subresult; - } + } } - return $result; + return $result; } /* * Merge results */ - function merge_results($a1, $a2) { - - reset($a2); - - while (list($key, $val) = each($a2)) - { - if (isset($a1[$key])) - { - if (is_array($val)) - { - if ($key != 'nserver') - $a1[$key] = $this->merge_results($a1[$key], $val); - } - else - { - $val = trim($val); - if ($val != '') - $a1[$key] = $val; - } - } - else - $a1[$key] = $val; - } - - return $a1; + function merge_results($a1, $a2) { + + reset($a2); + + while (list($key, $val) = each($a2)) + { + if (isset($a1[$key])) + { + if (is_array($val)) + { + if ($key != 'nserver') + $a1[$key] = $this->merge_results($a1[$key], $val); + } + else + { + $val = trim($val); + if ($val != '') + $a1[$key] = $val; + } + } + else + $a1[$key] = $val; + } + + return $a1; } - function FixNameServer($nserver) - { - $dns = array(); - - foreach($nserver as $val) - { - $val = str_replace( array('[',']','(',')'), '', trim($val)); - $val = str_replace("\t", ' ', $val); - $parts = explode(' ', $val); - $host = ''; - $ip = ''; - - foreach($parts as $p) - { - if (substr($p,-1) == '.') $p = substr($p,0,-1); - - if ((ip2long($p) == - 1) or (ip2long($p) === false)) - { - // Hostname ? - if ($host == '' && preg_match('/^[\w\-]+(\.[\w\-]+)+$/',$p)) - { - $host = $p; - } - } - else - // IP Address - $ip = $p; - } - - // Valid host name ? - - if ($host == '') continue; - - // Get ip address - - if ($ip == '') - { - $ip = gethostbyname($host); - if ($ip == $host) $ip = '(DOES NOT EXIST)'; - } - - if (substr($host,-1,1) == '.') $host = substr($host,0,-1); - - $dns[strtolower($host)] = $ip; - } - - return $dns; - } + function FixNameServer($nserver) + { + $dns = array(); + + foreach($nserver as $val) + { + $val = str_replace( array('[',']','(',')'), '', trim($val)); + $val = str_replace("\t", ' ', $val); + $parts = explode(' ', $val); + $host = ''; + $ip = ''; + + foreach($parts as $p) + { + if (substr($p,-1) == '.') $p = substr($p,0,-1); + + if ((ip2long($p) == - 1) or (ip2long($p) === false)) + { + // Hostname ? + if ($host == '' && preg_match('/^[\w\-]+(\.[\w\-]+)+$/',$p)) + { + $host = $p; + } + } + else + // IP Address + $ip = $p; + } + + // Valid host name ? + + if ($host == '') continue; + + // Get ip address + + if ($ip == '') + { + $ip = gethostbyname($host); + if ($ip == $host) $ip = '(DOES NOT EXIST)'; + } + + if (substr($host,-1,1) == '.') $host = substr($host,0,-1); + + $dns[strtolower($host)] = $ip; + } + + return $dns; + } }