Jump to content

working with dns_get_record


drisate

Recommended Posts

Hey guys i need to find the DNS of a hudge list of domains to check if there pointing at my server or not. This is what i did:

 

$str = 'AAL-T.COM<br>
AADQ.CA<br>
ACADEMIENOUVELLEGENERATION.COM<br>
AEFMQ.CA<br>
AEFMQ.COM<br>
AEFMQ.ORG<br>
AERO-ATELIER.COM<br>';
// [...]

$line = explode('<br>', strtolower($str));

foreach($line as $domain){
$dns = dns_get_record($domain, DNS_NS);
sort($dns);
echo "<strong>$domain</strong><br>";
foreach ($dns as $record) {
echo $record['target']."<br/>";
}
echo '<hr>';
}
?>

 

For some reason the first loop outputs the target right but every other domain after if ruturns empty ... am i missing something?

Link to comment
https://forums.phpfreaks.com/topic/262567-working-with-dns_get_record/
Share on other sites

It looks like this:

 

aal-t.com

ns1.loumic.com

ns2-r3-chicago.webserversystems.com

ns2.loumic.com

-------------------------------------------------------

aadq.ca

-------------------------------------------------------

academienouvellegeneration.com

-------------------------------------------------------

aefmq.ca

-------------------------------------------------------

aefmq.com

-------------------------------------------------------

aefmq.org

-------------------------------------------------------

aero-atelier.com

-------------------------------------------------------

Hey guys i need to find the DNS of a hudge list of domains to check if there pointing at my server or not. This is what i did:

 

$str = 'AAL-T.COM<br>
AADQ.CA<br>
ACADEMIENOUVELLEGENERATION.COM<br>
AEFMQ.CA<br>
AEFMQ.COM<br>
AEFMQ.ORG<br>
AERO-ATELIER.COM<br>';
// [...]

$line = explode('<br>', strtolower($str));

foreach($line as $domain){
$dns = dns_get_record($domain, DNS_NS);
sort($dns);
echo "<strong>$domain</strong><br>";
foreach ($dns as $record) {
echo $record['target']."<br/>";
}
echo '<hr>';
}
?>

 

For some reason the first loop outputs the target right but every other domain after if ruturns empty ... am i missing something?

 

$str = 'AAL-T.COM<br>
AADQ.CA<br>
ACADEMIENOUVELLEGENERATION.COM<br>
AEFMQ.CA<br>
AEFMQ.COM<br>
AEFMQ.ORG<br>
AERO-ATELIER.COM<br>';

 

is different than:

 

$str = 'AAL-T.COM<br>AADQ.CA<br>ACADEMIENOUVELLEGENERATION.COM<br>AEFMQ.CA<br>AEFMQ.COM<br>AEFMQ.ORG<br>AERO-ATELIER.COM<br>';

 

Your method is redundant to begin with as you should just create an array of domains to check in the first place:

 

$lines = array(
'AAL-T.COM',
'AADQ.CA',
'ACADEMIENOUVELLEGENERATION.COM',
'AEFMQ.CA',
'AEFMQ.COM',
'AEFMQ.ORG',
'AERO-ATELIER.COM'
);

 

That will work.

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.