homepage Welcome to WebmasterWorld Guest from 54.211.201.65
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
dns get record occasionally returns an empty array
Nameservers
adder




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

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




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

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




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

@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




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

For these problematic domains can you retrieve any DNS information?

adder




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved