Craig van Tonder Craig van Tonder - 1 year ago 127
PHP Question

PHP - dns_get_record - Why is DNS_PTR always returning an empty array?

I am trying to obtain ptr records for a domain.

For some reason when i try to do this using dns_get_record it is constantly coming back as empty.

I did try this originally and got a whole range of results but now its just returning an empty array every time... Could someone suggest the reason behind this behaviour?

$result = dns_get_record("", DNS_PTR);

outputs :


When it would be populated with values?

Any suggestions, advice or feedback would be greatly appreciated as i cannot for the life of my figure out why this is happening now!

Answer Source



$result = dns_get_record("", DNS_PTR);


    [0] => Array
            [host] =>
            [class] => IN
            [ttl] => 108002
            [type] => PTR
            [target] =>


You wont get prt from a domain name. You need to run it on a reverse name.

you can get more info in here:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download