Here is my current code:
function get_cmd ()
{
if (file_exists('/usr/local/bin/whois'))
$cmd = '/usr/local/bin/whois';
elseif (file_exists('/usr/bin/whois'))
$cmd = '/usr/bin/whois';
elseif (file_exists('/bin/whois'))
$cmd = '/bin/whois';
else
die('whois shell command does not exist');
return $cmd;
}
function get_whois ($cmd, $domain)
{
if (checkdnsrr($domain))
$result = shell_exec(escapeshellcmd($cmd ." ". $domain));
else
$result = 'DOMAIN IS NOT REGISTERED';
return $result;
}
$cmd = get_cmd();
echo get_whois($cmd, 'google.com');
now, is there a different method that will easily allow me to extract the expiration date of the domain without having to come up with a whole bunch of different regex? since the information will be formatted differently for every domain...
i've went ahead and just used regular expressions for this. some registrars don't even provide expiration dates in their whois.