Jump to content

rdns with php


ziegel

Recommended Posts

I am trying to build a script that will show all of the different domains that are hosted on the same ip. However when I do a rdns lookup with php only 1 of the domains is returned. How can I make it return all of the domains? I am trying to build a set of dns sort of tools for developers that use my webspace. I know I could just use curl and go to a site that does this already but I would like to make my own so that I know how it is done.

Link to comment
https://forums.phpfreaks.com/topic/177603-rdns-with-php/
Share on other sites

Well...

gethostbyaddr()

 

or another piece of code I was pointed to while trying to search for my answer:

 

function getRdnsRecord($ip) {
/*
* Validate IP
*/ 
if(!ip2long($ip)) {
   trigger_error("Error: Invalid IP",
                 E_USER_NOTICE);
   return FALSE;
}

/*
* Break the IP into 4 octets
*/
$array = explode(".", $ip, 4);

/*
* Reverse the order of the octets
*/
$array = array_reverse($array);

/*
* Assemble our zone
*/
$zone = implode(".", $array) 
      . ".in-addr.arpa";

/*
* Return the Resulting record
*/
return dns_get_record($zone, DNS_PTR);
}

Link to comment
https://forums.phpfreaks.com/topic/177603-rdns-with-php/#findComment-936467
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.