国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php查詢whois信息的方法

2024-05-04 23:35:59
字體:
來源:轉載
供稿:網友

這篇文章主要介紹了php查詢whois信息的方法,涉及php域名查詢的相關技巧,需要的朋友可以參考下

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

這里使用php通過查詢whois信息的網站列表進行查詢

 

 
  1. function whois_query($domain) { 
  2. // fix the domain name: 
  3. $domain = strtolower(trim($domain)); 
  4. $domain = preg_replace('/^http://///i'''$domain); 
  5. $domain = preg_replace('/^www/./i'''$domain); 
  6. $domain = explode('/'$domain); 
  7. $domain = trim($domain[0]); 
  8. // split the TLD from domain name 
  9. $_domain = explode('.'$domain); 
  10. $lst = count($_domain)-1; 
  11. $ext = $_domain[$lst]; 
  12. // You find resources and lists  
  13. // like these on wikipedia:  
  14. // 
  15. // http://de.wikipedia.org/wiki/Whois 
  16. // 
  17. $servers = array
  18. "biz" => "whois.neulevel.biz"
  19. "com" => "whois.internic.net"
  20. "us" => "whois.nic.us"
  21. "coop" => "whois.nic.coop"
  22. "info" => "whois.nic.info"
  23. "name" => "whois.nic.name"
  24. "net" => "whois.internic.net"
  25. "gov" => "whois.nic.gov"
  26. "edu" => "whois.internic.net"
  27. "mil" => "rs.internic.net"
  28. "int" => "whois.iana.org"
  29. "ac" => "whois.nic.ac"
  30. "ae" => "whois.uaenic.ae"
  31. "at" => "whois.ripe.net"
  32. "au" => "whois.aunic.net"
  33. "be" => "whois.dns.be"
  34. "bg" => "whois.ripe.net"
  35. "br" => "whois.registro.br"
  36. "bz" => "whois.belizenic.bz"
  37. "ca" => "whois.cira.ca"
  38. "cc" => "whois.nic.cc"
  39. "ch" => "whois.nic.ch"
  40. "cl" => "whois.nic.cl"
  41. "cn" => "whois.cnnic.net.cn"
  42. "cz" => "whois.nic.cz"
  43. "de" => "whois.nic.de"
  44. "fr" => "whois.nic.fr"
  45. "hu" => "whois.nic.hu"
  46. "ie" => "whois.domainregistry.ie"
  47. "il" => "whois.isoc.org.il"
  48. "in" => "whois.ncst.ernet.in"
  49. "ir" => "whois.nic.ir"
  50. "mc" => "whois.ripe.net"
  51. "to" => "whois.tonic.to"
  52. "tv" => "whois.tv"
  53. "ru" => "whois.ripn.net"
  54. "org" => "whois.pir.org"
  55. "aero" => "whois.information.aero"
  56. "nl" => "whois.domain-registry.nl" 
  57. ); 
  58. if (!isset($servers[$ext])){ 
  59. die('Error: No matching nic server found!'); 
  60. $nic_server = $servers[$ext]; 
  61. $output = ''
  62. // connect to whois server: 
  63. if ($conn = fsockopen ($nic_server, 43)) { 
  64. fputs($conn$domain."/r/n"); 
  65. while(!feof($conn)) { 
  66. $output .= fgets($conn,128); 
  67. fclose($conn); 
  68. else { die('Error: Could not connect to ' . $nic_server . '!'); } 
  69. return $output
  70. // Some example queries: 
  71. print whois_query('jonasjohn.de'); 
  72. print whois_query('example.com'); 
  73. print whois_query('example.org'); 

希望本文所述對大家的php程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 巴塘县| 灵寿县| 阜宁县| 油尖旺区| 金坛市| 界首市| 黎川县| 徐汇区| 东源县| 建德市| 清新县| 英山县| 镇赉县| 元朗区| 博乐市| 抚顺市| 海林市| 玉山县| 汉川市| 涿州市| 和硕县| 济阳县| 柳河县| 安吉县| 清远市| 汕尾市| 太谷县| 团风县| 三门峡市| 开封县| 太仓市| 蓝田县| 宁德市| 花莲县| 麻栗坡县| 休宁县| 东安县| 屏东县| 拉萨市| 金秀| 富锦市|