Search code examples
phpdnspear

Using NET_DNS2 Get records


I'm using pear package NET_DNS2. I can get records using the code below. But i have some confusion about the nameserver 8.8.8.8. This is Google Public name server address. Why we are using this. And how can i change this to my own name server for local host.

<?php

require "NET/DNS2.php";

$r = new Net_DNS2_Resolver(array('nameservers' => array('8.8.8.8')));
$result = $r->query('domain.com', 'A');

echo "<pre>";
print_r($result);
echo "</pre>";

?>

How can i get Domain Owner and Hosting provider information. Please help


Solution

  • NET_DNS2 communicate with the dns server by sending request from the specified nameserver.

    You can use your own computer Ip address for this (Not 127.0.0.1 or localhost)