PHP Txt dns doesn't give new data

one text

I am trying to get a txt DNS record. I have added it to a site but after some time it still doesn't display it. What am I doing wrong?

Here is my code:

$checkDomain = "example.com";
$domainKey = "testkey"; //These data are just for show. I know it doesn't exists on this domain

$dnsArray = dns_get_record($checkDomain, DNS_TXT);

foreach ($dnsArray as $dns) {
    if ($dns['type'] == "TXT") { // extra check, just incase...
        if ($dns['txt'] == "$domainKey") {
            //domain contains this DNS record
            echo 'true';
        } else {
            //something is wrong...
            echo 'false';
        }
    }
}

When I try to get DNS_ANY data I receive the following error:

Warning: dns_get_record(): A temporary server error occurred.

But when I try to get DNS_TXT I receive the following data:

  [0]=> // Note that this is not the new TXT record I am searching for
  array(6) {
    ["host"]=>
    string(28) "site"
    ["class"]=>
    string(2) "IN"
    ["ttl"]=>
    int(300)
    ["type"]=>
    string(3) "TXT"
    ["txt"]=>
    string(38) "v=spf1 include:_spf.transip.email ~all"
    ["entries"]=>
    array(1) {
      [0]=>
      string(38) "v=spf1 include:_spf.transip.email ~all"
    }
  }
}

Source