esnic.whois rewrite to accomodate new output
This commit is contained in:
parent
347d3f3bf3
commit
fbb8feb115
|
@ -1,4 +1,11 @@
|
|||
2003/09/06 David Saez <david@ols.es>
|
||||
2003/09/09 David Saez <david@ols.es>
|
||||
- fixed some warning when ip is banned
|
||||
on domainbank.whois
|
||||
- main.whois also sets regyinfo.whois on http
|
||||
queries
|
||||
- rewrite of esnic.whois
|
||||
|
||||
2003/09/08 David Saez <david@ols.es>
|
||||
- rewrite of cnnic.whois
|
||||
- some fixes to wsnic.whois
|
||||
- some fixes to gtld.whois and generic3.whois
|
||||
|
|
123
esnic.whois
123
esnic.whois
|
@ -27,10 +27,22 @@
|
|||
*/
|
||||
|
||||
/* esnic.whois 1.0 David Saez Padros <david@ols.es> */
|
||||
/* esnic.whois 1.1 David Saez Padros <david@ols.es> */
|
||||
|
||||
if(!defined("__ESNIC_HANDLER__")) define("__ESNIC_HANDLER__",1);
|
||||
|
||||
require_once("generic.whois");
|
||||
require_once('generic3.whois');
|
||||
|
||||
function buscar ($what, $where)
|
||||
{
|
||||
$search = trim(strstr($what[0],' '));
|
||||
|
||||
while (list ($key, $val) = each ($where)) {
|
||||
if (array_search($search,$val))
|
||||
return $val;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
class esnic extends Whois {
|
||||
|
||||
|
@ -40,56 +52,83 @@ class esnic extends Whois {
|
|||
|
||||
function parse ($data_str) {
|
||||
|
||||
$translate = array (
|
||||
"NIC-Handle" => "handle",
|
||||
"Nombre" => "name",
|
||||
"Organización" => "organization",
|
||||
"E-Mail" => "email",
|
||||
"Teléfono" => "phone",
|
||||
"Dirección (Calle,No...)" => "address.address",
|
||||
"Dirección (Municipio)" => "address.city",
|
||||
"Dirección (Cod. Postal)" => "address.pcode",
|
||||
"Dirección (Provincia)" => "address.state",
|
||||
"Dirección (Pais)" => "address.country",
|
||||
"Dominio" => "name",
|
||||
"Estado" => "status",
|
||||
"Acronimo de proveedor" => "sponsor",
|
||||
"Serv. primario" => "nserver.",
|
||||
"Serv. secundario" => "nserver.",
|
||||
"Forma Jurídica" => "type"
|
||||
);
|
||||
$items = array( 'domain.name' => 'Nombre del dominio ',
|
||||
'domain.status' => 'Estado ',
|
||||
'domain.created' => 'Fecha de Alta ',
|
||||
'domain.expires' => 'Fecha Caducidad ',
|
||||
'domain.nserver' => 'Nombre Servidor:',
|
||||
'domain.sponsor' => 'Agente Registrador',
|
||||
'owner' => 'Tipo de Contacto Titular:',
|
||||
'admin' => 'Tipo de Contacto Administrativo:',
|
||||
'billing' => 'Tipo de Contacto Facturación:',
|
||||
'tech' => 'Tipo de Contacto Técnico:'
|
||||
);
|
||||
|
||||
$contacts = array (
|
||||
"c. administrativo" => "admin",
|
||||
"c. técnico" => "tech",
|
||||
"c. facturación" => "billing"
|
||||
);
|
||||
$citms = array ( 'handle' => 'NIC_HANDLE',
|
||||
'name' => 'Nombre',
|
||||
'type' => 'Tipo de Titular',
|
||||
'organization' => 'Organización',
|
||||
'email' => 'EMAIL',
|
||||
'phone' => 'Teléfono',
|
||||
'fax' => 'Fax',
|
||||
'address' => 'Domicilio',
|
||||
'city' => 'Población',
|
||||
'zcode' => 'Código Postal',
|
||||
'country' => 'País'
|
||||
);
|
||||
|
||||
unset($data_str["rawdata"][0]);
|
||||
$data = array();
|
||||
$cont = array();
|
||||
$curr = array();
|
||||
$cdat = true;
|
||||
|
||||
$r["rawdata"] = $data_str["rawdata"];
|
||||
$r["regyinfo"] = array("whois"=>"www.nic.es",
|
||||
"referrer"=>"http://www.nic.es",
|
||||
"registrar"=>"ES-NIC" );
|
||||
while (list ($key, $val) = each ($data_str['rawdata'])) {
|
||||
if (trim($val)=='DETALLES CONTACTOS') {
|
||||
$cdat = false;
|
||||
continue;
|
||||
}
|
||||
if (trim($val)=='SERVIDORES DNS') {
|
||||
$cdat = true;
|
||||
continue;
|
||||
}
|
||||
if (trim($val)=='Nombre Servidor IP') {
|
||||
$data[]='Nombre Servidor:';
|
||||
continue;
|
||||
}
|
||||
if (substr($val,0,17)=='Tipo de Contacto ') {
|
||||
$data[]=$val.':';
|
||||
continue;
|
||||
}
|
||||
if ($cdat) {
|
||||
$data[]=$val;
|
||||
}
|
||||
else {
|
||||
if (substr($val,0,10)=='NIC_HANDLE') {
|
||||
if (!empty($curr))
|
||||
$cont[] = get_blocks($curr,$citms);
|
||||
$curr = array();
|
||||
}
|
||||
$curr[]=$val;
|
||||
}
|
||||
}
|
||||
|
||||
$rw = generic_whois($data_str["rawdata"],$translate,$contacts);
|
||||
if (!empty($curr))
|
||||
$cont[] = get_blocks($curr,$citms);
|
||||
|
||||
if (isset($rw["domain"]["organization"])) {
|
||||
$rw["owner"]["organization"]=$rw["domain"]["organization"];
|
||||
unset($rw["domain"]["organization"]);
|
||||
$rw["owner"]["address"]=$rw["domain"]["address"];
|
||||
unset($rw["domain"]["address"]);
|
||||
$rw["owner"]["nif"]=$rw["domain"]["nif"];
|
||||
unset($rw["domain"]["nif"]);
|
||||
$rw["owner"]["type"]=$rw["domain"]["type"];
|
||||
unset($rw["domain"]["type"]);
|
||||
}
|
||||
$r['regrinfo'] = get_blocks($data,$items);
|
||||
|
||||
$r["regrinfo"] = $rw;
|
||||
$r['regrinfo']['owner'] = buscar($r['regrinfo']['owner'],$cont);
|
||||
$r['regrinfo']['admin'] = buscar($r['regrinfo']['admin'],$cont);
|
||||
$r['regrinfo']['billing'] = buscar($r['regrinfo']['billing'],$cont);
|
||||
$r['regrinfo']['tech'] = buscar($r['regrinfo']['tech'],$cont);
|
||||
|
||||
$r['regyinfo'] = array('referrer'=>'http://www.nic.es',
|
||||
'registrar'=>'ES-NIC' );
|
||||
|
||||
$r['rawdata'] = $data_str['rawdata'];
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -353,7 +353,7 @@ class Whois {
|
|||
if(isSet($this->DATA[$this->Query["tld"]]))
|
||||
$result = $this->Process($result);
|
||||
|
||||
$result['regyinfo']['whois'] = $this->Query["server"];
|
||||
$result['regyinfo']['whois'] = strtok($this->Query["server"],'?');
|
||||
return($result);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ $this->DATA = array(
|
|||
"cn" => "cnnic",
|
||||
"com" => "gtld",
|
||||
"de" => "denic",
|
||||
# "es" => "esnic",
|
||||
"es" => "esnic",
|
||||
"fm" => "dotfm",
|
||||
"info" => "info",
|
||||
"li" => "chnic",
|
||||
|
|
Loading…
Reference in a new issue