phpWhois.org/generic2.whois
2002-12-16 20:44:38 +00:00

44 lines
1.2 KiB
Text
Executable file

<?php
function generic_whois ( $rawdata, $items )
{
$r="";
$disok=true;
while (list($key,$val)=each($rawdata))
{ if (trim($val)!="")
{ reset($items);
$ok=0;
if ($val[0]=='%' && $disok)
{ $r['disclaimer'][]=trim(substr($val,1));;
$disok=true;
continue;
}
$disok=false;
while (list($field, $match)=each($items))
{ if (strstr($val,$match))
{ $parts=explode(".",$field);
$var="\$r";
while (list($fn,$mn)=each($parts))
if ($mn=="")
$var=$var."[]";
else $var=$var."[\"".$mn."\"]";
$itm=trim(substr($val,strlen($match)));
if ($itm!="")
eval($var."=\"".$itm."\";");
$ok=1;
break;
}
}
if ($ok==0 && $val[0]==" ")
eval($var."=\"".trim($val)."\";");
}
}
return $r;
}