Reputation: 2567
I am trying to get the domain names of certain ipV4 addresses using gethostbyaddr()
function, but it does not return exactly what I'm looking for. For example this:
$hostname = gethostbyaddr("173.252.110.27");
echo $hostname;
will return: edge-star-ecmp-13-frc1.facebook.com
and google's ip address 73.252.110.27
returns:arn06s02-in-f5.1e100.net
is there some way to get it to return just: facebook.com or google.com? Thanks
Upvotes: 1
Views: 323
Reputation: 11586
Facebook, Google, Yahoo etc. setup unique FQDNS for each of their servers on a secondary domain name (fbcdn.net, 1e100.net, yimg.com respectively). This lets them keep their primary domain name exclusively for their products. For your requirement, you'll have to manually map the secondary domain names returned by the PTR
query to the company's primary domain name.
BTW, 1e100 stands for 1.0 * 10^100 which is a Googol.
Upvotes: 1
Reputation: 179994
This is called reverse DNS lookup and requires a PTR record. Ask your host to set one up.
No, you're not going to be able to change the PTR records for Google/Facebook. What you see is what you get with those ones.
Upvotes: 1