Jump to content

Want to get domain age


phpnerd

Recommended Posts

Hi All,

        I would like to get domain age. I searched for code in google and I got the following code.

 

class whois

{

    const timeout = 30;

    const whoishost = 'whois.internic.net';

   

    public static function lookup($domain){

 

      $result = "";

      $errno = 0;

      $errstr='';

   

      $fd = fsockopen(whois::whoishost,43, $errno, $errstr, whois::timeout);

 

      if ($fd){

            fputs($fd, $domain."\015\012");

          while (!feof($fd))    {

            $result .= fgets($fd,128) . "<br />";

          }

          fclose($fd);

        }

        return $result;

    }

}

 

$domain = 'google.com';

 

$result = whois::lookup($domain); 

 

 

 

 

if(strstr($result, " No match")){

      echo $domain . " seems to be available";

}else{

    echo $domain . " is in use";

    echo "<hr>";

    echo $result;

}

 

But this code returns a whole bunch of data all of which is not required. If it the output could be returned in an array, the desired result can be achieved.

 

Can anyone suggest if there is any straight forward way to get individual data like the header response of a domain or may be the domain age. Any help would be appreciated.

 

 

Link to comment
https://forums.phpfreaks.com/topic/242042-want-to-get-domain-age/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.