phpWhois.org/uknic.whois
2002-10-16 18:48:40 +00:00

112 lines
3.4 KiB
Text

<?php
/*
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.
*/
/* uknic.whois 1.2 David Saez Padros <david@ols.es> */
/* Fixed detection of non-existant domains */
/* uknic.whois 1.3 8/1/2002 Added status (active/inactive/detagged) */
/* and corrected error for detagged domains */
/* (like blue.co.uk) thanx to Adam Greedus */
/* uknic.whois 1.4 16/10/2002 Updated for new Nominet whois output */
/* also updated for common object model */
if(!defined("__UKNIC_HANDLER__")) define("__UKNIC_HANDLER__",1);
class uknic extends Whois {
function uknic($data) {
$this->result=$this->parse($data);
}
function parse ($data_str) {
$items=array(
"owner.organization" => "Registrant:",
"domain.name" => "Domain Name:",
"domain.sponsor" => "Registrant's Agent:",
"domain.created" => "Registered on:",
"domain.changed" => "Last updated:"
);
$r["rawdata"]=$data_str["rawdata"];
while (list($key, $val)=each($data_str["rawdata"])) {
$val=trim($val);
if ($val!="") {
if ($val=="Name servers listed in order:") {
while (list($key, $val)=each($data_str["rawdata"])) {
if (!($value=trim($val))) break;
$ns=split(" ",$value);
for ($i=0;$ns[$i]=="";$i++);
$r["regrinfo"]["domain"]["nserver"][]=$ns[$i];
}
break;
}
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;
}
}
}
if (!empty($r["regrinfo"]["domain"]["name"])) {
$r["regyinfo"]["whois"]="whois.nic.uk";
$r["regyinfo"]["referrer"]="www.nic.uk";
$r["regyinfo"]["registrar"]="Nominet UK";
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="";
return($r);
}
}
?>