phpWhois.org/generic2.whois
2005-07-16 11:10:31 +00:00

76 lines
1.9 KiB
Text
Executable file

<?php
/*
Generic3.php PHP functions for parsing whois output
Copyright (C)2003
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.
*/
require_once('getdate.whois');
require_once('genutil.whois');
function generic_whois ( $rawdata, $items, $dateformat='mdy' )
{
$r='';
$disok=true;
while (list($key,$val)=each($rawdata))
{ if (trim($val)!='')
{
if (($val[0]=='%' || $val[0]=='#') && $disok)
{ $r['disclaimer'][]=trim(substr($val,1));
$disok=true;
continue;
}
$disok=false;
reset($items);
while (list($field, $match)=each($items))
{
$pos=strpos($val,$match);
if ($pos!==false)
{
$var="\$r".getvarname($field);
$itm=trim(substr($val,$pos+strlen($match)));
if ($itm!='')
eval($var."=\"".$itm."\";");
break;
}
}
}
}
if (empty($r))
$r['registered'] = 'no';
else
{
$r['registered'] = 'yes';
format_dates($r,$dateformat);
}
return $r;
}
?>