title: dnsbl blacklist query not working on Linux server
body: <p>I'm having a problem is that if I run my this script on local wampserver then it show the correct result if it already blacklisted but if I run on my server etc... /usr/bin/php path-to-phpscript.php then it shows that this ip is blacklisted in all bls names which is not correct.</p>
  
  <pre><code>&lt;?php
  
  $bls = array("b.barracudacentral.org",
  "bl.score.senderscore.com",
  "pbl.spamhaus.org",
  "sbl.spamhaus.org",
  "xbl.spamhaus.org",
  "zen.spamhaus.org",
  "dbl.spamhaus.org",
  "sbl-xbl.spamhaus.org",
  );
  
  
  $ip = '62.213.183.192';
  
  if ( isset($ip)) {
  
  if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) || false === filter_var($ip, FILTER_VALIDATE_URL)) {
  
      if (false === filter_var($ip, FILTER_VALIDATE_URL  )) { 
          $iptosplit = gethostbyname($ip);
      }
      else {
          $iptosplit = $ip;
      }
      $splitip = explode (".", $iptosplit);
      $iptolookup = "$splitip[3].$splitip[2].$splitip[1].$splitip[0]";
      $counter=1;
      $blList = array();
      foreach ( $bls as $rbl ) {
          //echo "&lt;tr&gt;";
          $rbllookup = $iptolookup.".".$rbl;
          $lookup = gethostbyname($rbllookup);
  
          if ( $lookup != $rbllookup || $lookup == $ip) {
              $qtxtresult = dns_get_record("$rbllookup", DNS_TXT);
              if ( ! isset($qtxtresult[0]['txt']) ) {
                  $qtxtresult[0]['txt'] = "";
              }
              $blList[$counter]=$ip.' is listed in ('.$rbl.')';
              echo '...........Listed in -'.$rbl.'&lt;br /&gt;';                
          }
          echo str_repeat(" ", 24), "\n";
  
          $counter++;
      }
  }
  }
  ?&gt;
  </code></pre>