1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

DNS TXT Record Lookup

Discussion in 'PHP' started by medialab, Mar 20, 2018.

  1. #1
    Hey Everyone!

    I am trying to verify users own a domain by adding in a TXT record on it, I have found quite a bit of code in PHP that allows for this, I am currently using this:
    $domain = $_POST['domain'];
    $verify = $_POST['verify'];
        if(checkdnsrr("$domain","TXT")) {
            $result = dns_get_record("$domain",DNS_TXT);
            if (isset($result[0]["txt"]) && $result[0]["txt"] == $verify) {
            echo "Success!";
    I am having a major issue though, because of the TTL (I am assuming), 9 out of 10 times it doesn't work, sometimes it can take hours before it does. I was using MX tools TXT lookup and they pull up the new TXT record in seconds, is there any way to get the TXT record immediately with PHP?

    I am worried that it will take to long to get the users domain verified and they will forget or go somewhere else because of the delay.

    Any help would be greatly appreciated!!
    medialab, Mar 20, 2018 IP
  2. jestep

    jestep Prominent Member Premium Member

    Likes Received:
    Best Answers:
    Trophy Points:
    What type of server is this on and what servers is it using for lookups?
    jestep, Mar 22, 2018 IP