Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Request #16763 authorative info only: do not have server names includ…

…ed in output.

git-svn-id: http://svn.php.net/repository/pear/packages/Net_Whois/trunk@290369 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit e54640099f942881416dd5a51f48bc1f8812c7f5 1 parent 64b21a3
Ken Guest kenguest authored
Showing with 35 additions and 1 deletion.
  1. +22 −1 Whois.php
  2. +7 −0 tests/test_authorative.php
  3. +6 −0 tests/test_mult.php
23 Whois.php
View
@@ -44,6 +44,14 @@ class Net_Whois extends PEAR
// {{{ properties
/**
+ * Retrieve authorative definition only
+ *
+ * @var boolean
+ * @access public
+ */
+ var $authorative = false;
+
+ /**
* List of NICs to query
*
* @var array
@@ -103,6 +111,7 @@ class Net_Whois extends PEAR
function Net_Whois()
{
$this->PEAR();
+ $this->authorative = false;
}
// }}}
@@ -142,6 +151,18 @@ function query($domain, $userWhoisServer = null)
return $whoisData;
}
+ if (($this->authorative)
+ && (preg_match('/To single out one record/i', $whoisData))
+ ) {
+ $whoisData = $this->_connect('whois.crsnic.net', "=$domain");
+ $pos = strpos($whoisData, 'Domain Name:');
+ $chunk = substr($whoisData, $pos);
+ $matches = array();
+ preg_match('/Whois Server:(?<server>.*)/', $chunk, $matches);
+ $server = trim($matches['server']);
+ $whoisData = $this->_connect(trim($matches['server']), "$domain");
+ }
+
return $whoisData;
}
// }}}
@@ -198,7 +219,7 @@ function queryRADB($ipAddress)
// {{{ _chooseServer()
/**
- * Determines the correct server to connect to based upon the domin
+ * Determines the correct server to connect to based upon the domain
*
* @param string $domain IP address or host name
*
7 tests/test_authorative.php
View
@@ -0,0 +1,7 @@
+<?php
+require_once 'Net/Whois.php';
+$nw = new Net_Whois;
+$nw->authorative = true;
+echo $nw->query ("facebook.com");
+
+?>
6 tests/test_mult.php
View
@@ -0,0 +1,6 @@
+<?php
+require_once 'Net/Whois.php';
+$nw = new Net_Whois;
+echo $nw->query ("facebook.com");
+
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.