require 'uri'
Net::HTTP.get(URI.parse("http://www.oreilly.com"))
response = Net::HTTP.get_response('www.oreilly.com', '/about/')
puts case response.code[0] # Check the first byte of the response code.
when ?1 then "Status code indicates an HTTP informational response."
when ?2 then "Status code indicates success."
when ?3 then "Status code indicates redirection."
when ?4 then "Status code indicates client error."
when ?5 then "Status code indicates server error."
else "Non-standard status code."
end