怎么通过ip获取域名?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBオリジナル
2016-06-13 10:44:321433ブラウズ

如何通过ip获取域名??
我用gethostbyaddr('里面放ip');每次只返回ip而不是返回域名,貌似只有输入127.0.0.1才能返回域名,百度,和谷歌都不行,这个函数到底咋用呢!!!!

function gethost ($ip)
{
  return ( preg_match('/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.]
(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/', $ip) ) ? gethostbyaddr($ip) : false;

}

------解决方案--------------------

PHP code
function getContent($url){      $content=file_get_contents($url);      return $content;  }   function getResult($ip){      $pagesize=10;      $page=1;      $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page";      $result=array();      do     {          $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page";          $content=getContent($url);          $pattern="/<cite>([a-zA-Z0-9\.]*)(?:\/.*)?/isU";          preg_match_all($pattern, $content, $matches);          $result=array_merge($result,$matches[1]);          $nextpage=strpos($content, "下一页");          $page=$page+$pagesize;      }while($nextpage);            $result=array_values(array_unique($result));            return $result;  }   // 调用方法$result=getResult("220.181.111.85");//$result=getResult("117.79.93.222");//csdnecho "<pre class="brush:php;toolbar:false">";print_r($result);<div class="clear">
                 
              
              
        
            </div>
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。