检查PHP中域名的可用性

时间:2013-12-01 00:46:16

标签: php dns

我编写了自己的脚本,用于检查文本文件中包含的单词列表中的域名(PHP)的可用性,但我得到了很高的假结果。

我使用checkdnsrr()函数来检查是否有DNS记录。

是否有更有效的方法来检查域名的可用性?

谢谢。

<?php
$file = fopen("list-words.txt", "r"); 

if ( $file)
{
     while ( ( $line = fgets( $file) ) !== false )
     { 
          $words[] .= cleanWord( trim( $line ) );
     }
     fclose( $file);
}

$nb = 5;
$ltd = '.com';
$list = '<ul>';
for( $i = 0; $i < count( $words); $i++ )
{ 
     if( strlen( $words[$i] ) == $nb_nb )
     { 
          if( !checkdnsrr( $words[$i].$ltd, 'ANY' ) )
          { 
              $list.= '<li>'.$words[$i].$ltd.'</li>';
          }
     }
}
$list.= '</ul>';
echo $list;
?>

0 个答案:

没有答案