gurkanbicer/getdns

该软件包最新版本(v1.1.0)没有提供许可证信息。

GetDNS 是 dig 命令结果的解析器。

安装: 2

依赖: 0

推荐: 0

安全性: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:项目

v1.1.0 2024-09-10 18:58 UTC

This package is auto-updated.

Last update: 2024-09-10 19:01:43 UTC


README

"GetDNS"

GetDNS

GetDNS 是 dig 命令结果的解析器。本软件包包括使用随机公共 DNS 服务器查询 DNS 记录和查询域名服务器的功能。

示例用法

use Gurkanbicer\Getdns\Getdns;
use Gurkanbicer\Getdns\Exceptions\EmptyResponseException;
use Gurkanbicer\Getdns\Exceptions\InvalidDomainException;
use Symfony\Component\Process\Exception\ProcessTimedOutException;
use Symfony\Component\Process\Exception\ProcessFailedException;

$getdns = new Getdns();

try {
    $getdns->setDomain("grkn.co");
    $aRecords = $getdns->queryDns("A");
    var_dump($aRecords);

    $domainNameservers = $getdns->queryDomainNameservers();
    var_dump($domainNameservers);
} catch (ProcessFailedException) {
    echo "The process has been failed.";
} catch (ProcessTimedOutException) {
    echo "The process has been timed out.";
}

示例输出

array(5) {
  ["status"]=>
  string(7) "NOERROR"
  ["data"]=>
  array(2) {
    [0]=>
    string(12) "188.114.97.3"
    [1]=>
    string(12) "188.114.96.3"
  }
  ["query"]=>
  string(1) "A"
  ["nameserver"]=>
  string(7) "9.9.9.9"
  ["command"]=>
  string(65) "dig +nocmd +noall +multiline +answer +comments grkn.co A @9.9.9.9"
}

安装

您可以通过 Composer 安装它:composer require gurkanbicer/getdns

要求

  • PHP >= 8.0.2
  • 在您的服务器上应运行 dig 命令,否则您应安装此软件包(安装方法:[https://command-not-found.com/dig](https://command-not-found.com/dig))
  • 您的 PHP 环境不应禁用 proc_open 函数和其他以 proc_ 开头的函数

支持的 DNS 类型

  • NS
  • SOA
  • A
  • AAAA
  • CNAME
  • MX
  • TXT
  • SRV
  • 实际域名服务器(所有者指向的)

捐赠

如果您想支持我,您可以

"Buy Me A Coffee"