require 'uri' require 'net/http' url = "http://www.whatever.com/whatever.txt" r = Net::HTTP.get_response(URI.parse(url).host, URI.parse(url).path)
r.code = 200 | 404 | 500, etc
r.body = *text of page*
11387 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
require 'uri' require 'net/http' url = "http://www.whatever.com/whatever.txt" r = Net::HTTP.get_response(URI.parse(url).host, URI.parse(url).path)
get_response, of course.require 'open-uri' puts open("http://jicksta.com").read
You need to create an account or log in to post comments to this site.
rather than parse twice and pull out the important bits.