require 'net/http' require 'xmlsimple' url = "http://www.user-agents.org/allagents.xml" xml_data = Net::HTTP.get_response(URI.parse(url)).body data = XmlSimple.xml_in(xml_data) agents = data['user-agent'].select{|agent| type = agent["Type"].first; type.include?("R") || type.include?("S")} agent_names = agents.collect {|agent| agent["String"].first}