沃梦达 / 编程问答 / php问题 / 正文

我如何通过 PHP 知道 IP 的域?

How I can know the Domain for an IP by PHP?(我如何通过 PHP 知道 IP 的域?)

本文介绍了我如何通过 PHP 知道 IP 的域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过 PHP 知道 IP 的域?

How I can know the Domain for an IP by PHP?

我用过这个代码

<?php
  $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  echo $hostname;
?>

但它不能正常工作.例如:

But it doesn't work correctly. For example:

gethostbyaddr(62.75.138.253);

域名是 earthwar.de 但正确答案是 German-proxy.de

domain name is earthwar.de but the correctly answer is german-proxy.de

请帮忙.

推荐答案

一个 IP 地址可以托管无限数量的域.gethostbyaddr 返回的域将提供来自该 IP 的 PTR DNS 记录的域名.反向 DNS 记录 (PTR) 将 IP 地址映射到一个或多个域名.

A single IP address can host a potentially unlimited number of domains. Domains returned by gethostbyaddr will give the domain name(s) from the PTR DNS records for that IP. A reverse DNS record (PTR) maps IP addresses to one or more domain names.

domaintools.com 就是这样一家提供 IP 地址域情报的公司.您可以为他们收集的此类信息付费.如果域名不在 PTR 记录中,那么您知道 IP 地址上有哪些域的唯一方法是尝试将域名解析为其 IP 地址并保留记录.AFIK 没有其他办法.

One such company that provides intelligence as far as domains on IP addresses is domaintools.com. You can pay for such information that they have harvested. If the domain name is not in the PTR record, then the only way you can know what domains are on an IP address is by attempting to resolve domain names to their IP addresses and keeping records. AFIK there is no other way.

请参阅反向 DNS 查找 和 域名工具反向IP查找

域名工具反向IP查询的数据都是基于他们的挖掘、收集和研究.

The data from the reverse IP lookup on domain tools is all based on their mining, collection and research.

这篇关于我如何通过 PHP 知道 IP 的域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:我如何通过 PHP 知道 IP 的域?

基础教程推荐