Вход Регистрация
* -=(C)DRU987=- (Dev)

WHOIS ЗАПРОС С ПОМОЩЬЮ PHP

  1. function whois_query($domain) {
  2.  
  3. // fix the domain name:
  4. $domain = strtolower(trim($domain));
  5. $domain = preg_replace('/^http:\/\//i', '', $domain);
  6. $domain = preg_replace('/^www\./i', '', $domain);
  7. $domain = explode('/', $domain);
  8. $domain = trim($domain[0]);
  9.  
  10. // split the TLD from domain name
  11. $_domain = explode('.', $domain);
  12. $lst = count($_domain)-1;
  13. $ext = $_domain[$lst];
  14.  
  15. // You find resources and lists
  16. // like these on wikipedia:
  17. //
  18. //
  19. $servers = array(
  20. "biz" => "whois.neulevel.biz",
  21. "com" => "whois.internic.net",
  22. "us" => "whois.nic.us",
  23. "coop" => "whois.nic.coop",
  24. "info" => "whois.nic.info",
  25. "name" => "whois.nic.name",
  26. "net" => "whois.internic.net",
  27. "gov" => "whois.nic.gov",
  28. "edu" => "whois.internic.net",
  29. "mil" => "rs.internic.net",
  30. "int" => "whois.iana.org",
  31. "ac" => "whois.nic.ac",
  32. "ae" => "whois.uaenic.ae",
  33. "at" => "whois.ripe.net",
  34. "au" => "whois.aunic.net",
  35. "be" => "whois.dns.be",
  36. "bg" => "whois.ripe.net",
  37. "br" => "whois.registro.br",
  38. "bz" => "whois.belizenic.bz",
  39. "ca" => "whois.cira.ca",
  40. "cc" => "whois.nic.cc",
  41. "ch" => "whois.nic.ch",
  42. "cl" => "whois.nic.cl",
  43. "cn" => "whois.cnnic.net.cn",
  44. "cz" => "whois.nic.cz",
  45. "de" => "whois.nic.de",
  46. "fr" => "whois.nic.fr",
  47. "hu" => "whois.nic.hu",
  48. "ie" => "whois.domainregistry.ie",
  49. "il" => "whois.isoc.org.il",
  50. "in" => "whois.ncst.ernet.in",
  51. "ir" => "whois.nic.ir",
  52. "mc" => "whois.ripe.net",
  53. "to" => "whois.tonic.to",
  54. "tv" => "whois.tv",
  55. "ru" => "whois.ripn.net",
  56. "org" => "whois.pir.org",
  57. "aero" => "whois.information.aero",
  58. "nl" => "whois.domain-registry.nl"
  59. );
  60.  
  61. if (!isset($servers[$ext])){
  62. die('Error: No matching nic server found!');
  63. }
  64.  
  65. $nic_server = $servers[$ext];
  66.  
  67. $output = '';
  68.  
  69. // connect to whois server:
  70. if ($conn = fsockopen ($nic_server, 43)) {
  71. fputs($conn, $domain."\r\n");
  72. while(!feof($conn)) {
  73. $output .= fgets($conn,128);
  74. }
  75. fclose($conn);
  76. }
  77. else { die('Error: Could not connect to ' . $nic_server . '!'); }
  78.  
  79. return $output;
  80. }
» Описание: Если вам нужно получить информацию Whois для конкретного домена, то почему бы не использовать для этого PHP? Следующая функция берет доменное имя в качестве параметра, а затем отображает информацию Whois.
» Время добавления: 23 Фев 2022 в 20:42
» Посмотров: 698
» textarea
» Рейтинг: [+0 | -0]
Комментарии [0]
Онлайн: 4
Реклама