title: How do I work around dns_get_record returning false positives
body: <p>I've been trying to use functions like dns_get_record($domain) to check the validity of a domain.  The problem is if it's not a valid domain it appends it on front of the domain for the sites IP that I'm on.  I can't rely on any of the gethostbyname, dns_get_record, etc functions for this as they don't work as I expect them to.  </p>
  
  <p>If a domain doesn't exist, I expect any of these functions return a failed result.  Its not.  I notice using the 'ping' command does the same thing as the PHP functions do, but the 'host' command works as expected.  </p>
  
  <p>I write a C program to use gethostbyname and it works as expected.  Same with python 'socket.gethostbyname'.  They both fail on a lookup with an invalid domain.</p>
  
  <p>What is going on with the PHP functions?  Why are they not behaving as I expect them too and fail on an invalid domain name?</p>
  
  <p>using the following on a host with the domain name of example.com give the following.</p>
  
  <pre><code>dns_get_record('something')
  
  Array
      (
          [0] =&gt; Array
              (
                  [host] =&gt; somthing.example.com
                  [type] =&gt; A
                  [ip] =&gt; some ip address
                  [class] =&gt; IN
                  [ttl] =&gt; 600
              )
  
      )
  </code></pre>
  
  <p>This is not what I want.  If there is a bug, a link to the bug would be appreciated, thanks</p>
  
  <p>UPDATE:</p>
  
  <p>As correctly pointed out by @Barmar, it's the way the DNS records have been set up.  I found on my home computer, which has PHP on it, the function gethostbyname() and friends work exactly as expected.</p>
  
  <p>This begs the question of how can you reliable check to see if a domain is valid when your DNS is setup to enable wildcards. The only way I found was to use command line tolls and call them from PHP.  I don't like this option, but it's the only one I got at the moment, and it's not a frequently called operation anyway, luckily.</p>