Welcome to WebmasterWorld Guest from 54.226.241.8

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

dns get record occasionally returns an empty array

Nameservers

     

adder

12:02 pm on Mar 28, 2013 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hi,

Just a simple script designed to return nameserver info. In 99.9% cases it works ok, only occasionally it returns an empty array.

<?php
$nsresult = dns_get_record("example.com", DNS_NS);
echo $nsresult[0]['target'];
echo "<br/>";
echo $nsresult[1]['target'];
?>


if I print the result for the whole $nsresult variable of a faulty domain, I get this on the screen:

Array ( )


When I look up the domain's nameservers via Whois and try to ping them, they will respond, so the nameservers aren't down. Is it some sort of a misconfiguration on the nameserver? Is there another way to make them respond?
Thanks!

penders

8:17 pm on Apr 2, 2013 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Does your script always fail on this problematic domain?

Is the problematic domain on the same server as your script (shared hosting)? In this case dns_get_record() can apparently return an empty array when attempting to get the nameservers, according to this comment on PHP.net: [php.net...]

adder

11:07 am on Apr 12, 2013 (gmt 0)

10+ Year Member Top Contributors Of The Month



@penders,

Yes, it will fail on the same domain over and over again. The poblematic domain is not on the same server as my script. Out of 100 randomly selected domains, 1 to 3 will always return an empty array.

penders

11:25 am on Apr 12, 2013 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



For these problematic domains can you retrieve any DNS information?

adder

11:00 pm on Apr 12, 2013 (gmt 0)

10+ Year Member Top Contributors Of The Month



No, not with dns_get_record regardless of what type parameter I put in the brackets. So, I was wondering if there was an alternative.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month