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
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

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.