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ì)有所幫助。
您可能感興趣的文章:
- php whois查詢API制作方法
- 用PHP查詢域名狀態(tài)whois的類
- PHP實(shí)現(xiàn)域名whois查詢的代碼(數(shù)據(jù)源萬網(wǎng)、新網(wǎng))
- 用PHP實(shí)現(xiàn)標(biāo)準(zhǔn)的IP Whois查詢
- PHP Socket網(wǎng)絡(luò)操作類定義與用法示例
- PHP+Ajax 檢測(cè)網(wǎng)絡(luò)是否正常實(shí)例詳解
- php判斷是否連接上網(wǎng)絡(luò)的方法實(shí)例詳解
- PHP使用CURL實(shí)現(xiàn)對(duì)帶有驗(yàn)證碼的網(wǎng)站進(jìn)行模擬登錄的方法
- 使用PHP curl模擬瀏覽器抓取網(wǎng)站信息
- PHP whois查詢類定義與用法示例
相關(guān)文章
PHP獲取數(shù)組中重復(fù)最多的元素的實(shí)現(xiàn)方法
這篇文章主要介紹了PHP獲取數(shù)組中重復(fù)最多的元素的實(shí)現(xiàn)方法,通過一個(gè)自定義函數(shù)遍歷數(shù)組實(shí)現(xiàn)這一功能,是非常使用的技巧,需要的朋友可以參考下2014-11-11php實(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-11php使用ftp遠(yuǎn)程上傳文件類(完美解決主從文件同步問題的方法)
下面小編就為大家?guī)硪黄猵hp使用ftp遠(yuǎn)程上傳文件類(完美解決主從文件同步問題的方法)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-09-09PHP實(shí)現(xiàn)多圖上傳(結(jié)合uploadify插件)思路分析
這篇文章主要介紹了PHP實(shí)現(xiàn)多圖上傳的方法,實(shí)例分析了php結(jié)合uploadify插件實(shí)現(xiàn)多圖上傳的具體步驟與相關(guān)操作技巧,需要的朋友可以參考下2016-11-11PHP 命名空間和自動(dòng)加載原理與用法實(shí)例分析
這篇文章主要介紹了PHP 命名空間和自動(dòng)加載,結(jié)合實(shí)例形式分析了PHP 命名空間和自動(dòng)加載具體功能、概念、原理與使用技巧,需要的朋友可以參考下2020-04-04