Skip to content

Instantly share code, notes, and snippets.

@seven1m
Created December 21, 2010 07:03
Show Gist options
  • Select an option

  • Save seven1m/749604 to your computer and use it in GitHub Desktop.

Select an option

Save seven1m/749604 to your computer and use it in GitHub Desktop.
# this has NOT been tested!
require 'net/http'
require 'uri'
uri = URI("http://google.com")
content = ''
Net::HTTP.get_response(uri) do |res|
return if res.header['Content-Type'].split(';').first != 'text/html'
res.read_body do |chunk|
content << chunk
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment