Reverse IP lookup with PHP

Marcus picture Marcus · Aug 5, 2010 · Viewed 17.7k times · Source

In PHP is there a function to do a reverse lookup on a domain name to find out how many websites are hosted on the particular shared hosting server that domain name is hosted on. Or, a way to do this with PHP?

Now, I'm already aware of the online services that offer this. However, I want to write a script to do it myself. I just can't figure it out.

Any suggestions that are not suggesting the use of a 3rd party service would be great.

Answer

HiTech picture HiTech · Mar 19, 2014

In PHP just use

$domain = gethostbyaddr($ip);

good luck!