Revision: 5530
Updated Code
at March 13, 2008 16:36 by cczona
Updated Code
require "open-uri" uri="http://www.ruby-lang.org/en/" html=URI.parse(uri).read # string representation is the response body http_headers=URI.parse(uri).read.meta # this hash's keys are also accessible as OpenURI instance methods, e.g. html.content_type
Revision: 5529
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 13, 2008 16:26 by cczona
Initial Code
require "open-uri" uri="http://www.ruby-lang.org/en/" puts URI.parse(uri).read puts '*' * 20 puts URI.parse(uri).read.meta.each { |k, v| puts k + "t" + v}
Initial URL
Initial Description
URI objects can be opened directly by open-uri
Initial Title
parse URI object, and fetch response from it, in one step
Initial Tags
url, textmate, ruby
Initial Language
Other