PHP获取DNS记录而不缓存
有谁知道如何检索域的 DNS 记录。
到目前为止,我一直在使用 php 和这个函数:dns_get_record
来执行此操作,但我意识到该命令获取缓存的 DNS 记录,因此不是最新信息。
有谁知道用 PHP 或其他语言解决这个问题的方法吗?
Does anyone know how its possible to retrieve the DNS records for a domain.
I have been using php and this function: dns_get_record
to do this so far but have realized that this command gets cached DNS records and therefore not the up to date information.
Does anyone know a way around this in PHP or some other language?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许这不是一个“礼貌的修复”,但从 php 你也可以调用系统命令和 shell 脚本:
即:
所以:
Maybe it's not a "polite fix" but from php you can also call system commands and shell scripts:
i.e:
So:
最简单的解决方案是使用 Net_DNS PEAR 包。
The simplest solution would be to use Net_DNS PEAR Package.
你真的需要那个吗? DNS 记录不会经常更改,绕过本地缓存只会减慢查询速度(特别是当您开始进行递归查询时),而没有任何实际收益。
如果您确实需要,请查找或编写一个可以进行递归查询的 DNS 解析器。
Do you really need that? DNS records doesn't change that often, and bypassing local cache will only slow queries down (especially if you start making recursive ones), with no real gain.
If you do need that, find or write a DNS resolver that can make recursive queries.