亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

php查詢whois信息的方法

 更新時(shí)間:2015年06月08日 09:51:38   作者:不吃皮蛋  
這篇文章主要介紹了php查詢whois信息的方法,涉及php域名查詢的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了php查詢whois信息的方法。分享給大家供大家參考。具體如下:

這里使用php通過查詢whois信息的網(wǎng)站列表進(jìn)行查詢

function whois_query($domain) {
  // fix the domain name:
  $domain = strtolower(trim($domain));
  $domain = preg_replace('/^http:\/\//i', '', $domain);
  $domain = preg_replace('/^www\./i', '', $domain);
  $domain = explode('/', $domain);
  $domain = trim($domain[0]);
  // split the TLD from domain name
  $_domain = explode('.', $domain);
  $lst = count($_domain)-1;
  $ext = $_domain[$lst];
  // You find resources and lists 
  // like these on wikipedia: 
  //
  // http://de.wikipedia.org/wiki/Whois
  //
  $servers = array(
    "biz" => "whois.neulevel.biz",
    "com" => "whois.internic.net",
    "us" => "whois.nic.us",
    "coop" => "whois.nic.coop",
    "info" => "whois.nic.info",
    "name" => "whois.nic.name",
    "net" => "whois.internic.net",
    "gov" => "whois.nic.gov",
    "edu" => "whois.internic.net",
    "mil" => "rs.internic.net",
    "int" => "whois.iana.org",
    "ac" => "whois.nic.ac",
    "ae" => "whois.uaenic.ae",
    "at" => "whois.ripe.net",
    "au" => "whois.aunic.net",
    "be" => "whois.dns.be",
    "bg" => "whois.ripe.net",
    "br" => "whois.registro.br",
    "bz" => "whois.belizenic.bz",
    "ca" => "whois.cira.ca",
    "cc" => "whois.nic.cc",
    "ch" => "whois.nic.ch",
    "cl" => "whois.nic.cl",
    "cn" => "whois.cnnic.net.cn",
    "cz" => "whois.nic.cz",
    "de" => "whois.nic.de",
    "fr" => "whois.nic.fr",
    "hu" => "whois.nic.hu",
    "ie" => "whois.domainregistry.ie",
    "il" => "whois.isoc.org.il",
    "in" => "whois.ncst.ernet.in",
    "ir" => "whois.nic.ir",
    "mc" => "whois.ripe.net",
    "to" => "whois.tonic.to",
    "tv" => "whois.tv",
    "ru" => "whois.ripn.net",
    "org" => "whois.pir.org",
    "aero" => "whois.information.aero",
    "nl" => "whois.domain-registry.nl"
  );
  if (!isset($servers[$ext])){
    die('Error: No matching nic server found!');
  }
  $nic_server = $servers[$ext];
  $output = '';
  // connect to whois server:
  if ($conn = fsockopen ($nic_server, 43)) {
    fputs($conn, $domain."\r\n");
    while(!feof($conn)) {
      $output .= fgets($conn,128);
    }
    fclose($conn);
  }
  else { die('Error: Could not connect to ' . $nic_server . '!'); }
  return $output;
}
// Some example queries:
print whois_query('jonasjohn.de');
print whois_query('example.com');
print whois_query('example.org');

希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • PHP獲取數(shù)組中重復(fù)最多的元素的實(shí)現(xiàn)方法

    PHP獲取數(shù)組中重復(fù)最多的元素的實(shí)現(xiàn)方法

    這篇文章主要介紹了PHP獲取數(shù)組中重復(fù)最多的元素的實(shí)現(xiàn)方法,通過一個(gè)自定義函數(shù)遍歷數(shù)組實(shí)現(xiàn)這一功能,是非常使用的技巧,需要的朋友可以參考下
    2014-11-11
  • php實(shí)現(xiàn)簡(jiǎn)單的上傳進(jìn)度條

    php實(shí)現(xiàn)簡(jiǎn)單的上傳進(jìn)度條

    大家在上傳文件時(shí)都會(huì)看到一個(gè)非常精致的進(jìn)度條,從進(jìn)度條上我們很直觀的可以看到文件、圖片上傳進(jìn)度,本文分享了php實(shí)現(xiàn)簡(jiǎn)單的上傳進(jìn)度條,感興趣的小伙伴們可以參考一下。
    2015-11-11
  • Thinkphp單字母函數(shù)使用指南

    Thinkphp單字母函數(shù)使用指南

    本文給大家匯總介紹了thinkphp中的單字母函數(shù)的使用方法,非常的簡(jiǎn)單,他們都在 /THINKPHP/Common/functions.php 這個(gè)文件中 下面我分別說明一下他們的使用方法
    2016-05-05
  • php使用ftp遠(yuǎn)程上傳文件類(完美解決主從文件同步問題的方法)

    php使用ftp遠(yuǎn)程上傳文件類(完美解決主從文件同步問題的方法)

    下面小編就為大家?guī)硪黄猵hp使用ftp遠(yuǎn)程上傳文件類(完美解決主從文件同步問題的方法)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2016-09-09
  • 使用GD庫生成帶陰影文字的圖片

    使用GD庫生成帶陰影文字的圖片

    這篇文章主要介紹了使用GD庫生成帶陰影文字的圖片的方法,非常的細(xì)致,推薦給大家,需要的朋友可以參考下
    2015-03-03
  • PHP實(shí)現(xiàn)的策略模式示例

    PHP實(shí)現(xiàn)的策略模式示例

    這篇文章主要介紹了PHP實(shí)現(xiàn)的策略模式,簡(jiǎn)單介紹了策略模式的概念、原理并結(jié)合實(shí)例形式分析了php策略模式的相關(guān)實(shí)現(xiàn)與使用技巧,需要的朋友可以參考下
    2019-03-03
  • php 函數(shù)中使用static的說明

    php 函數(shù)中使用static的說明

    看PW源碼的時(shí)候發(fā)現(xiàn)setHeader()函數(shù)中使用static關(guān)鍵字,很奇怪,以前也沒這樣用過。static用在函數(shù)里面,聲明一次變量后,如果再次調(diào)用這個(gè)函數(shù)將會(huì)在初始值延續(xù),如$sapi這里將累加
    2012-06-06
  • php顯示指定目錄下子目錄的方法

    php顯示指定目錄下子目錄的方法

    這篇文章主要介紹了php顯示指定目錄下子目錄的方法,涉及php操作目錄的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-03-03
  • PHP實(shí)現(xiàn)多圖上傳(結(jié)合uploadify插件)思路分析

    PHP實(shí)現(xiàn)多圖上傳(結(jié)合uploadify插件)思路分析

    這篇文章主要介紹了PHP實(shí)現(xiàn)多圖上傳的方法,實(shí)例分析了php結(jié)合uploadify插件實(shí)現(xiàn)多圖上傳的具體步驟與相關(guān)操作技巧,需要的朋友可以參考下
    2016-11-11
  • PHP 命名空間和自動(dòng)加載原理與用法實(shí)例分析

    PHP 命名空間和自動(dòng)加載原理與用法實(shí)例分析

    這篇文章主要介紹了PHP 命名空間和自動(dòng)加載,結(jié)合實(shí)例形式分析了PHP 命名空間和自動(dòng)加載具體功能、概念、原理與使用技巧,需要的朋友可以參考下
    2020-04-04

最新評(píng)論