CodeIgniter Forums
How to get domain details? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to get domain details? (/showthread.php?tid=19819)



How to get domain details? - El Forum - 06-19-2009

[eluser]Mareshal[/eluser]
I am trying to get something like this:

Code:
Domain : domain.com
IP : DOMAIN_IP
Registrar : ENOM, INC.
    
Nameservers : NS1.NAMESERVER.NET (NS_IP)
              NS2.NAMESERVER.NET (NS_IP)
    
Created :    DATE_CREATED
Updated :    DATE_UPDATED
Expires :    DATE_EXPIRES

I tried, but I didn't find something to do this.

The only thing I could do, was to get DOMAIN_IP (easy).

Any ideas? Does CodeIgniter have some plugins/libraries to do something like this?


How to get domain details? - El Forum - 06-19-2009

[eluser]slowgary[/eluser]
Are you trying to start your own WHOIS service? CodeIgniter doesn't store the internet's DNS information. You'd need to get that information from a DNS server.


How to get domain details? - El Forum - 06-19-2009

[eluser]Mareshal[/eluser]
Nooo. I don't want my own whois service. DomainTools is the best. I need to integrate that part in a script.
Is some kind of a voting site for different sites, and after I add a site from admin panel, visitors must see some simple WHOIS data. I have some scripts from internet but they return a lot of crap data, and I reall don't need that.

I will also implement Alexa rank, Google pagerank and Compete.

EDIT: I got this script(view screenshot from server -> http://www.phpace.com/wp-content/uploads/2008/09/whois.jpg ) and I modified it a bit, to make the whois query trought a function or a GET variable. Returns what I want, but too much raw data on bottom of the page.


How to get domain details? - El Forum - 06-19-2009

[eluser]Mareshal[/eluser]
Code:
<?PHP
$result = dns_get_record($_GET['d'], DNS_ANY, $authns, $addtl);

$count = sizeof($result);
$i=0;
$nameserver = array();
while($i < $count) {
    $temp_array = $result[$i];
  
    if($temp_array['type'] == "NS") { array_push($nameserver, $temp_array ['target']); }

$i++;

}
$count = sizeof($nameserver);
$i=0;

echo "IP: ".gethostbyname($_GET['d'])."<br><br>";//get IP address

while($i < $count) {
       //This is just to show the contents of the nameserver array.
    print "nameserver[$i]: $nameserver[$i]<br>";

$i++;

}

?&gt;

this is the code to get NameServers for a domain. Taken from another forum, not own made.


How to get domain details? - El Forum - 02-01-2014

[eluser]Unknown[/eluser]
You can get the script for getting nameservers :-

&lt;?PHP
$result = dns_get_record("YOURDOMAIN.COM", DNS_ANY, $authns, $addtl);

$count = sizeof($result);
$i=0;
$nameserver = array();
while($i < $count) {
$temp_array = $result[$i];

if($temp_array['type'] == "NS") { array_push($nameserver, $temp_array ['target']); }

$i++;

}
$count = sizeof($nameserver);
$i=0;

while($i < $count) {
//This is just to show the contents of the nameserver array.
print "nameserver[$i]: $nameserver[$i]<br>";

$i++;

}

?&gt;


Live demo of this :- www.whoismyhost.com