lundi 30 mars 2015

Better aproache to deal with dns_get_record


Vote count:

0




I can't understand how someone can build such crap for a wide use language.


But anyway the behavior of dns_get_record


query the A record:



var_dump(dns_get_record($host, DNS_A));




array(1) {
[0]=>
array(5) {
["host"]=>
string(14) "host.name.tdl"
["class"]=>
string(2) "IN"
["ttl"]=>
int(0)
["type"]=>
string(1) "A"
["ip"]=>
string(12) "192.168.17.2"
}
}


query the AAAA record:



var_dump(dns_get_record($host, DNS_AAAA));




PHP Warning: dns_get_record(): DNS Query failed in file.php on line 4
bool(false)


I find it a bit strange that no record is returned as false and not as empty array but I guess it's a way to do it.


Combine it:



var_dump(dns_get_record($host, DNS_A + DNS_AAAA));




PHP Warning: dns_get_record(): DNS Query failed in file.php on line 4
bool(false)


And here is my question: Is there a better way to query the A and AAAA record with out doing two dns_get_record calls?



asked 1 min ago







Better aproache to deal with dns_get_record

Aucun commentaire:

Enregistrer un commentaire