rewrite of cnnic.whois

This commit is contained in:
sparc 2003-09-08 17:53:45 +00:00
parent ee4570871f
commit 7e63954ed9
3 changed files with 84 additions and 58 deletions

View file

@ -1,3 +1,6 @@
2003/09/06 David Saez <david@ols.es>
- rewrite of cnnic.whois
2003/09/06 David Saez <david@ols.es>
- Added handlers for .cn and .ws
thanx to zingfharn@fastmail.fm

View file

@ -1,75 +1,97 @@
<?php
<?php
/*
* Chinese (cn) registration tool
* Chewy - 2003/Sep/03
*
*/
Whois2.php PHP classes to conduct whois queries
Copyright (C)1999,2000 easyDNS Technologies Inc. & Mark Jeftovic
Maintained by Mark Jeftovic <markjr@easydns.com>
For the most recent version of this package:
http://www.easydns.com/~markjr/whois2/
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* lunic.whois 2.0 David Saez <david@ols.es> 2003/09/08 */
/* cnnic.whois 1.0 Chewy - 2003/Sep/03 */
if(!defined("__CNNIC_HANDLER__")) define("__CNNIC_HANDLER__",1);
require_once("generic2.whois");
class cnnic extends Whois {
function cnnic($data) {
$this->result=$this->parse($data);
$this->result = $this->parse($data);
}
function parse ($data_str) {
$items=array(
function parse($data_str) {
$items = array(
"domain.name" => "Domain Name:",
"owner.organization" => "Registrant Name:",
"domain.status" => "Domain Status:",
"domain.nserver." => "Name Server:",
"domain.created" => "Registration Date:",
"domain.expires" => "Expiration Date:",
"domain.sponsor" => "Sponsoring Registrar:",
"owner.name" => "Registrant Name:",
"owner.organization" => "Registrant Organization:",
"owner.address.address" => "Registrant Address:",
"owner.address.zcode" => "Registrant Postal Code:",
"owner.address.city" => "Registrant City:",
"owner.address.country" => "Registrant Country Code:",
"owner.email" => "Registrant Email:",
"owner.phone" => "Registrant Phone Number:",
"owner.fax" => "Registrant Fax:",
"admin.name" => "Administrative Name:",
"admin.organization" => "Administrative Organization:",
"admin.address.address" => "Administrative Address:",
"admin.address.zcode" => "Administrative Postal Code:",
"admin.address.city" => "Administrative City:",
"admin.address.country" => "Administrative Country Code:",
"admin.email" => "Administrative Email:",
"admin.phone" => "Administrative Phone Number:",
"admin.fax" => "Administrative Fax:",
"tech.name" => "Technical Name:",
"tech.organization" => "Technical Organization:",
"tech.address.address" => "Technical Address:",
"tech.address.zcode" => "Technical Postal Code:",
"tech.address.city" => "Technical City:",
"tech.address.country" => "tec-country:",
"tech.email" => "Technical Email:",
"tech.phone" => "Technical Phone Number:",
"tech.fax" => "Technical Fax",
"billing.name" => "Billing Name:",
"billing.organization" => "Billing Organization:",
"billing.address.address" => "Billing Address:",
"billing.address.zcode" => "Billing Postal Code:",
"billing.address.city" => "Billing City:",
"billing.address.country" => "Billing Country Code:",
"billing.email" => "Billing Email:",
"billing.phone" => "Billing Phone Number:",
"billing.fax" => "Billing Fax:"
);
$r["rawdata"]=$data_str["rawdata"];
while (list($key, $val)=each($data_str["rawdata"])) {
$val=trim($val);
if ($val!="") {
if (strstr($val, "Name Server:")) {
$dnsstr = split(":", $val);
$r["regrinfo"]["domain"]["nserver"][]= $dnsstr[1];
continue;
}
reset($items);
while (list($field, $match)=each($items))
if (strstr($val,$match)) {
$v=trim(substr($val,strlen($match)));
if ($v=="") {
$v=each($data_str["rawdata"]);
$v=trim($v["value"]);
}
$parts=explode(".",$field);
$var="\$r[\"regrinfo\"]";
while (list($fn,$mn)=each($parts))
$var=$var."[\"".$mn."\"]";
eval($var."=\"".$v."\";");
break;
}
}
}
$r["regyinfo"]["whois"]="whois.cnnic.net.cn";
$r["regyinfo"]["referrer"]="http://www.cnnic.net.cn/";
$r["regyinfo"]["registrar"]="China Nic";
if (!empty($r["regrinfo"]["domain"]["name"])) {
$r["regrinfo"]["registered"] = "yes";
if (!empty($r["regrinfo"]["domain"]["nserver"]))
$r["regrinfo"]["domain"]["status"]="active";
else {
if (strstr($r["regrinfo"]["domain"]["sponsor"],"DETAGGED"))
$r["regrinfo"]["domain"]["status"]="detagged";
else
$r["regrinfo"]["domain"]["status"]="inactive";
}
}
else
$r["regrinfo"]["registered"] = "no";
return($r);
}
$r["rawdata"] = $data_str["rawdata"];
$r["regyinfo"] = array("whois"=>"whois.cnnic.net.cn",
"referrer"=>"http://www.cnnic.net.cn",
"registrar" => "China NIC");
$r["regrinfo"] = generic_whois ($data_str["rawdata"],$items);
return($r);
}
}
?>

View file

@ -5,6 +5,7 @@ aunic telstra.com.au
brnic registro.br
chnic creart.ch blaueskreuz.ch
cira cira.ca (v)
cnnic cnnic.net.cn
denic 4ever.de
dotfm dot.fm
esnic ols.es