2002-10-16 17:13:06 +00:00
|
|
|
<?php
|
2003-02-15 14:34:32 +00:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
*/
|
2002-10-16 17:13:06 +00:00
|
|
|
|
2005-07-16 09:13:39 +00:00
|
|
|
require_once('getdate.whois');
|
2005-07-16 11:10:31 +00:00
|
|
|
require_once('genutil.whois');
|
2005-07-16 09:13:39 +00:00
|
|
|
|
|
|
|
function generic_whois ( $rawdata, $items, $dateformat='mdy' )
|
2002-10-16 17:13:06 +00:00
|
|
|
|
|
|
|
{
|
2005-07-16 09:13:39 +00:00
|
|
|
$r='';
|
2002-12-16 20:44:38 +00:00
|
|
|
$disok=true;
|
2002-10-16 17:13:06 +00:00
|
|
|
|
|
|
|
while (list($key,$val)=each($rawdata))
|
2005-07-16 09:13:39 +00:00
|
|
|
{ if (trim($val)!='')
|
2003-02-10 19:24:57 +00:00
|
|
|
{
|
2003-01-29 19:02:50 +00:00
|
|
|
if (($val[0]=='%' || $val[0]=='#') && $disok)
|
2003-02-10 19:24:57 +00:00
|
|
|
{ $r['disclaimer'][]=trim(substr($val,1));
|
2002-12-16 20:44:38 +00:00
|
|
|
$disok=true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$disok=false;
|
2003-02-10 19:24:57 +00:00
|
|
|
reset($items);
|
2002-10-16 17:13:06 +00:00
|
|
|
|
|
|
|
while (list($field, $match)=each($items))
|
2003-02-10 19:24:57 +00:00
|
|
|
{
|
|
|
|
$pos=strpos($val,$match);
|
2005-07-16 11:10:31 +00:00
|
|
|
if ($pos!==false)
|
|
|
|
{
|
|
|
|
$var="\$r".getvarname($field);
|
2003-01-29 19:02:50 +00:00
|
|
|
$itm=trim(substr($val,$pos+strlen($match)));
|
2005-07-16 09:13:39 +00:00
|
|
|
if ($itm!='')
|
2002-10-16 17:13:06 +00:00
|
|
|
eval($var."=\"".$itm."\";");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-08 19:17:36 +00:00
|
|
|
if (empty($r))
|
2003-09-08 19:40:47 +00:00
|
|
|
$r['registered'] = 'no';
|
2003-09-08 19:17:36 +00:00
|
|
|
else
|
2005-07-16 09:13:39 +00:00
|
|
|
{
|
2003-09-08 19:17:36 +00:00
|
|
|
$r['registered'] = 'yes';
|
2005-07-16 09:13:39 +00:00
|
|
|
format_dates($r,$dateformat);
|
|
|
|
|
|
|
|
}
|
2003-09-08 19:17:36 +00:00
|
|
|
|
2002-10-16 17:13:06 +00:00
|
|
|
return $r;
|
|
|
|
}
|
2003-02-15 14:34:32 +00:00
|
|
|
|
2004-04-23 08:47:20 +00:00
|
|
|
?>
|