Skip to content

Instantly share code, notes, and snippets.

@nuna
Created August 9, 2010 08:04
Show Gist options
  • Save nuna/515118 to your computer and use it in GitHub Desktop.
Save nuna/515118 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rubygems'
require 'em-http-request'
urls = %w(
http://www.livedoor.com/
http://www.dena.jp/
http://mixi.jp/
http://www.gaiax.co.jp/
)
EventMachine.run do
multi = EventMachine::MultiRequest.new
urls.each do |url|
multi.add(EventMachine::HttpRequest.new(url).get)
end
multi.callback do
multi.responses[:succeeded].each do |response|
puts "Got #{response.uri}"
end
EventMachine.stop
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment