在不使用 PECL 或 system() 类型函数的情况下,有没有办法使用 PHP 查找 DNS 记录?

发布于 2024-09-03 06:52:24 字数 244 浏览 3 评论 0原文

我正在致力于创建一种新型电子邮件协议,为此,我必须为我的域设置 SRV DNS 记录。

在推广此协议时,我需要能够发现给定主机是否使用我的系统(如果不使用旧协议)。

那么,有没有一种方法可以使用 PHP 提取 DNS 记录(例如 SRV),而不使用 PECL 扩展或通过 linux 命令行运行它(我已经知道我可以 ob_start() 和 system("host -t SRV hostname" )但我正在寻找更好的方法(如果存在)。)

I'm working on creating a new type of email protocol, and in order to do that I had to set up an SRV DNS record for my domain.

In promoting this protocol, I'll need to be able to discover if a given host uses my system (and if not fall back to an older protocol).

So, is there a way to pull a DNS record (such as SRV) using PHP without using a PECL extension or running it through the linux command line (I already know I can ob_start() and system("host -t SRV hostname") but I'm looking for a better way, if it exists.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清引 2024-09-10 06:52:24

使用 dns_get_record

array dns_get_record  (  string $hostname  [,  int $type = DNS_ANY  [,  array &$authns  [,  array &$addtl  ]]] )

获取关联的 DNS 资源记录
与给定的主机名。

Use dns_get_record

array dns_get_record  (  string $hostname  [,  int $type = DNS_ANY  [,  array &$authns  [,  array &$addtl  ]]] )

Fetch DNS Resource Records associated
with the given hostname.

未央 2024-09-10 06:52:24

您考虑过 PEAR::Net_DNS 吗?
http://pear.php.net/package/Net_DNS

据我所知使用套接字连接(tcp/udp)并解码解析器数据本身。可用的方法看起来相当广泛。

Have you considered PEAR::Net_DNS?
http://pear.php.net/package/Net_DNS

As far as I can tell it uses socket connections (tcp/udp) and decodes the resolver data itself. The available methods look pretty extensive.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文