开发者

php checkdnsrr function only works for dotcom domains?

checkdnsrr only works for dot com domains?

If I use live.com (or any existing dotcom),开发者_StackOverflow the checkdnsrr returns a value of 1 (TRUE), but it always return a empty string for an existing dot net/org. It does not matter if the check is for A or MX or NS... records. Is the syntax correct or something else?

<?php
$dom ="live.net";
$check = checkdnsrr($dom,'NS');
echo "live $check test ";
?>

TIA


checkdnsrr() doesn't return a string at all, it's a BOOL function, so either's true/false. Printing bools out directly is bad practice, because FALSE doesn't get turned into a 0 the way TRUE becomes 1. It's cast into an empty string and so is invisible.

At least change your check into something like:

echo "$dom test: " . ($check ? 'TRUE' : 'FALSE');

and get a proper 'true'/'false' text output.

That being said, live.com and live.net both resolve fine here for all sorts of DNS record types. I'd suggest using 'host or nslookup or dig on the server you're testing this from to see what they're getting for responses. PHP should be using the same resolver as those tools are.


The code you pasted works for me (TM).

Check your system DNS settings.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜