Craig van Tonder Craig van Tonder - 3 months ago 37
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("webstorm.co.za", DNS_PTR);
print_r($result);


outputs :

Array()


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

updated

try

$result = dns_get_record("41.78.244.4.in-addr.arpa.", DNS_PTR);
print_r($result);

outputs:

Array
(
    [0] => Array
        (
            [host] => 41.78.244.4.in-addr.arpa
            [class] => IN
            [ttl] => 108002
            [type] => PTR
            [target] => dialup-4.244.78.41.Dial1.StLouis1.Level3.net
        )

)

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

you can get more info in here: http://www.menandmice.com/knowledgehub/dnsqa/56/