PHP實現網域名稱whois查詢的代碼(資料來源萬網、新網)_PHP教程

來源:互聯網
上載者:User
萬網 whois(使用的介面為萬網提供合法介面)
複製代碼 代碼如下:
function whois_hichina($domain) {
preg_match("|
(.+?)
|is", @file_get_contents('http://whois.hichina.com/cgi-bin/whois?domain='.$domain.''), $whois);
$whois[0] = str_replace('友情提示:按註冊局要求,到期網域名稱可能會處於註冊商自動續約期階段,您在此查詢所看到的網域名稱到期日僅供參考
請您進入會員區查看該網域名稱的實際到期時間,並請及時進行續約,謝謝!', '', ($whois[0]));//過濾掉此段文字
return $whois[0]);
}

  新網 whois (非新網提供,只是根據新網自身網站的url修改實現)
複製代碼 代碼如下:
function whois_xinnet($domain) {
preg_match("|(.+?)|is", @file_get_contents('http://www.xinnet.cn/Modules/agent/serv/pages/domain_whois.jsp?domainNameWhois='.$domain.'&noCode=noCode'), $whois);
return $whois[0];
}
}

  上海電信測試,感覺新網的查詢要快一點,且萬網有些網域名稱查詢不出來的,新網亦可以查詢到!

http://www.bkjia.com/PHPjc/321224.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/321224.htmlTechArticle萬網 whois(使用的介面為萬網提供合法介面) 複製代碼 代碼如下: function whois_hichina($domain) { preg_match("|pre(.+?)/pre|is", @file_get_contents('http://whois...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.