title: How can I query the Spamhaus DBL in Ruby on Rails?
body: <p>I have a Rails web application.  I want to create a class that takes an email address, say "matt@trucksandstuff.com," parses out the domain, and then checks if the domain is found in the Spamhaus DBL.  I am having no luck with the dig or host commands as described on their website and the Charon gem doesn't seem to work with their sample URL either.  Any ideas?</p>
  
  <p>EDIT:  Here is what is on the website:</p>
  
  <p>In response to "How can I test the DBL?" they said: </p>
  
  <blockquote>
    <p>First, the DBL follows RFC5782 for determining whether a URI zone is operational with an entry for TEST. Second, the DBL has a specific domain for testing DBL applications: dbltest.com. To test functionality of the DBL use the host or dig command to do a manual query. (If you need to look up a domain in the DBL via the web, use the domain lookup form at our Blocklist Removal Center. Do not query our website with automated tools.).</p>
  </blockquote>
  
  <p>I have tried using the Charon gem, which I think should be as simple as running </p>
  
  <pre><code>Charon.query('dbltest.com')
  </code></pre>
  
  <p>with variations that remove the parentheses, add a space, etc.</p>
  
  <p>Also tried</p>
  
  <pre><code>resolver = Resolv::DNS.new
  name = 'dbltest.com'
  resolver.getresources("#{name}.zen.spamhaus.org", Resolv::DNS::Resource::IN::A)
  </code></pre>
  
  <p>in the Rails console.</p>