Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

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

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

I have used this code

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

But it doesn't work correctly. For example:

gethostbyaddr(62.75.138.253);

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

Please help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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.

See Reverse DNS Lookup and Domain tools reverse IP lookup

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...