From 18849d1a98b992190612cdb2561e7b4492c505f5 Mon Sep 17 00:00:00 2001 From: sparc Date: Sat, 13 Dec 2014 12:51:02 +0000 Subject: [PATCH] Fixed ARIN detection --- src/whois.ip.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/whois.ip.php b/src/whois.ip.php index 70e77f4..f834ec4 100644 --- a/src/whois.ip.php +++ b/src/whois.ip.php @@ -91,13 +91,14 @@ class ip_handler extends WhoisClient foreach($rwdata as $line) { + // can be removed ?? if (!strncmp($line,'American Registry for Internet Numbers',38)) continue; $p = strpos($line, '(NETBLK-'); if ($p === false) $p = strpos($line, '(NET-'); - if ($p !== false) + if ($p !== false && strpos($line,'Parent:') === false) { $net = strtok(substr($line,$p+1),') '); list($low,$high) = explode('-',str_replace(' ','',substr($line,$p+strlen($net)+3))); @@ -132,7 +133,7 @@ class ip_handler extends WhoisClient unset($this->Query['args']); - while (count($this->more_data) > 0) + while (count($this->more_data) > 0) { $srv_data = array_shift($this->more_data); $this->Query['server'] = $srv_data['server']; @@ -158,6 +159,9 @@ class ip_handler extends WhoisClient } } + // Just to be sure we get the origianl output if something goes wrong + + if (empty($result['rawdata'])) $result['rawdata'] = $rawdata; // Normalize nameserver fields