如何通过PHP知道IP域名? [英] How I can know the Domain for an IP by PHP?

查看:170
本文介绍了如何通过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.

在IP地址上提供智能的一家公司是domaintools.com。您可以支付他们收获的信息。如果域名不在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域名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆