Created
January 13, 2014 08:56
-
-
Save chaitu87/2f043edf7dd2ebb45ef0 to your computer and use it in GitHub Desktop.
Getting possible domain names from keywords
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'colorize' | |
name = ARGV[0] | |
domains = ["com","net","org","io","in"] | |
domains.each do |check| | |
ref = "#{name}.#{check}".to_s | |
doc = Nokogiri::XML(open("http://www.whoisxmlapi.com/whoisserver/WhoisService?cmd=GET_DN_AVAILABILITY&domainName=#{ref}&username=chaitu87&password=sowmya&outputFormat=XML")) | |
output = doc.at_xpath('//DomainInfo//domainAvailability').text | |
if output.to_s == "AVAILABLE" | |
puts "#{name}.#{check} Available".green | |
else | |
puts "#{name}.#{check} Not Available".red | |
end | |
# puts "#{name}.#{check}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment