modified $query parameter

This commit is contained in:
sparc 2005-07-28 07:00:22 +00:00
parent 1916405926
commit 6d934b52f4
5 changed files with 21 additions and 15 deletions

View file

@ -1,3 +1,6 @@
2005/07/28 David Saez <david@ols.es>
- modified $query parameter for parse function
2005/07/27 David Saez <david@ols.es>
- genutil, generic2 and getdate moved to
whois.parser.php

View file

@ -129,11 +129,11 @@ There is also a naming schema that must be followed, country
handlers are named whois.XX.php, where XX is the iso country
code. The handler must also define __XX_HANDLER__ and implement
a class named xx_handler with a function named parse that takes
two array arguments: $data_str and $query. $data_str['rawdata']
two arguments: $data_str and $query. $data_str['rawdata']
contains the raw output of the query and is what need to be parsed
in order to generate the Common Object Model. $query contains
some, rarely useful, data about the query. That function must
return an array with any available result in the format defined
the domain, ip adrress or AS that it's being queried. That function
must return an array with any available result in the format defined
by this document. Country handlers must be defined in the file
whois.servers.php on the array DATA where the key is the iso
country code and the value the handler name (xx).
@ -158,8 +158,8 @@ handlers, those functions are stored on the following files:
- generic_parser_a:
contains code to parse whois outputs like this one, you could
take a look at whois.at.php to see how you could use it:
contains code to parse whois outputs in RPSL format, like this one.
You could take a look at whois.at.php to see how you could use it:
domain: nic.at
registrant: NAIV1117337-NICAT

View file

@ -76,6 +76,8 @@ class WhoisClient {
// If domain to query passed in, use it, otherwise use domain from initialisation
$string = !empty($query) ? $query : $this->Query['string'];
$this->Query['string'] = $string;
if (!isset($this->Query['server'])) {
$this->Query['status'] = -1;
$this->Query['errstr'][] = 'No server specified';
@ -283,6 +285,6 @@ class WhoisClient {
$this->Query['errstr'][] = $handler->Query['errstr'];
// Return the result
return $handler->parse($result,$this->Query);
return $handler->parse($result,$this->Query['string']);
}
}

View file

@ -88,7 +88,7 @@ class gtld_handler extends WhoisClient {
function parse ($data,$query)
{
$this->Query = $query;
$this->Query = array();
$this->SUBVERSION = sprintf("%s-%s", $query["handler"], $this->HANDLER_VERSION);
$this->result = generic_parser_b($data["rawdata"],$this->REG_FIELDS,'dmy');
@ -104,7 +104,7 @@ class gtld_handler extends WhoisClient {
$this->Query["server"] = $this->result["regyinfo"]["whois"];
//}
$this->result["rawdata"] = $this->GetData($this->Query["string"]);
$this->result["rawdata"] = $this->GetData($query);
// david@ols.es 16/10/2002 Fixes rawdata
if (!isset($this->result["rawdata"]["rawdata"])) {

View file

@ -64,7 +64,8 @@ class ip_handler extends WhoisClient {
function parse ($data,$query)
{
$this->Query=$query;
$this->Query=array();
unset($this->Query['handler']);
if (!isset($result['rawdata']))
@ -93,7 +94,7 @@ while (list($string, $whois)=each($this->REGISTRARS))
switch ($this->Query['server'])
{
case 'whois.apnic.net':
$rawdata=$this->GetData($this->Query['string']);
$rawdata=$this->GetData($query);
$rawdata=$rawdata['rawdata'];
while (list($ln,$line)=each($rawdata))
@ -102,7 +103,7 @@ switch ($this->Query['server'])
{
$this->Query['server']='whois.krnic.net';
$result['regyinfo']['registrar']='Korea Network Information Center (KRNIC)';
$rawdata=$this->GetData($this->Query['string']);
$rawdata=$this->GetData($query);
$rawdata=$rawdata['rawdata'];
break;
}
@ -136,7 +137,7 @@ switch ($this->Query['server'])
{
$this->Query["server"]='whois.registro.br';
$result["regyinfo"]["registrar"]='Comite Gestor da Internet no Brasil';
$rawdata=$this->GetData($this->Query['string']);
$rawdata=$this->GetData($query);
$rawdata=$rawdata['rawdata'];
$newquery='';
}
@ -149,7 +150,7 @@ switch ($this->Query['server'])
break;
case 'whois.lacnic.net':
$rawdata=$this->GetData($this->Query['string']);
$rawdata=$this->GetData($query);
$rawdata=$rawdata['rawdata'];
while (list($ln,$line)=each($rawdata))
@ -159,7 +160,7 @@ switch ($this->Query['server'])
{
$this->Query['server']='whois.registro.br';
$result['regyinfo']['registrar']='Comite Gestor da Internet do Brazil';
$rawdata=$this->GetData($this->Query['string']);
$rawdata=$this->GetData($query);
$rawdata=$rawdata['rawdata'];
break;
}
@ -167,7 +168,7 @@ switch ($this->Query['server'])
break;
default:
$rawdata=$this->GetData($this->Query['string']);
$rawdata=$this->GetData($query);
if (isset($rawdata['rawdata'])) $rawdata=$rawdata['rawdata'];
}