History for < Domain finder - PHP >

Sort by: Date / Title /

  1. 1 year ago by spirit
    1. //-- Class
    2.  
    3. class whois
    4. {
    5.     const timeout = 30;
    6.     const whoishost = 'whois.internic.net';
    7.    
    8.     public static function lookup($domain){
    9.  
    10.        $result = "";
    11.        $errno = 0;
    12.        $errstr='';
    13.    
    14.        $fd = fsockopen(whois::whoishost,43, $errno, $errstr, whois::timeout);
    15.  
    16.        if ($fd){
    17.              fputs($fd, $domain."\015\012");
    18.            while (!feof($fd))    {
    19.             $result .= fgets($fd,128) . "<br />";
    20.            }
    21.            fclose($fd);
    22.         }
    23.          return $result;
    24.      }
    25. }
    26.  
    27.  
    28. //-- Example
    29.  
    30. $domain = 'search-for.com';
    31. $result = whois::lookup($domain)
    32.  
    33. if(strstr($result, "No match")){
    34.        echo $domain . "seems to be available";
    35. }else{
    36.     echo $domain . "is in use";
    37.     //echo "<hr>";
    38.     //echo $result;
    39. }

 

This posteet has also been saved without any changes by siddhy