Search code examples
rubyvalidationdnsregistrar

How can I use Ruby to check if a domain exists?


Something along the lines of:

def domain_exists?(domain)
  # perform check
  # return true|false
end

puts "valid!" if domain_exists?("example.com")

Solution

  • If you want to check whether a domain is registered or not, then you need to perform a Whois query. http://www.ruby-whois.org/