phpWhois.org/netsol.whois
2003-03-16 21:49:17 +00:00

84 lines
3.1 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.
*/
/* netsol.whois 1.0 mark jeftovic 1999/12/06 */
if(!defined("__NETSOL_HANDLER__")) define("__NETSOL_HANDLER__",1);
class netsol extends gtld {
function netsol($data) {
$this->result=$this->parse(
preg_replace("/\n+/","_",implode("\n",$data))
);
}
function parse ($data_str) {
$data_str=preg_replace("/\s+/"," ",$data_str);
preg_match("/^(.+)Registrant:_/",$data_str,$refs);
$r["disclaimer"]=preg_replace("/_/","\n",$refs[1]);
//preg_match("/^.+Registrant:_(.+)\s+\((.+-DOM)\)_/", $data_str,$refs);
preg_match("/^.+Registrant:_(.+)\s+\((.+)\)_\s*(.+)_\s*Domain Name:\s(.+)_/", $data_str,$refs);
$r["owner"]["organization"]=$refs[1];
$r["owner"]["handle"]=$refs[2];
$r["owner"]["address"]=explode("_",$refs[3]);
//preg_match("/\(.+-DOM\)_\s*(.+)_\s*Domain Name:\s(.+)_\sAdmin/",$data_str,$refs);
//$r["owner"]["address"]=explode("_",$refs[1]);
//preg_replace("/_/","\n",$refs[1]);
//$r["domain"]["name"]=$refs[2];
preg_match("/Administrative .*?Contact:_(.+?)\((.+?)\)\s(.+?@.+?)_/",$data_str, $refs);
$r["admin"]["name"]=$refs[1];
$r["admin"]["handle"]=$refs[2];
$r["admin"]["email"]=$refs[3];
preg_match("/Technical .*?Contact:_(.+?)\((.+?)\)\s(.+?@.+?)_/",$data_str, $refs);
$r["tech"]["name"]=$refs[1];
$r["tech"]["handle"]=$refs[2];
$r["tech"]["email"]=$refs[3];
preg_match("/Billing Contact:_(.+?)\((.+?)\)\s(.+?@.+?)_/",$data_str, $refs);
if (isset($refs[1])) $r["billing"]["name"]=$refs[1];
if (isset($refs[2])) $r["billing"]["handle"]=$refs[2];
if (isset($refs[3])) $r["billing"]["email"]=$refs[3];
//preg_match("/Record last updated on (.+?)\./",$data_str, $refs);
//$r["domain"]["changed"]=$refs[1];
preg_match("/Record created on (.+?)\./",$data_str, $refs);
$r["domain"]["created"]=$refs[1];
preg_match("/Record expires on (.+?)\./",$data_str, $refs);
$r["domain"]["expires"]=$refs[1];
preg_match("/Domain servers in listed order:_ (.+)$/",$data_str, $refs);
$ns=explode("_", $refs[1]);
for($i=0,$max=count($ns);$i<$max;$i++) {
@list($k,$v)=split(" ", trim($ns[$i]));
if ($k!="") $r["domain"]["nserver"][]=$k." [".$v."]";
}
return($r);
}
}
?>