One of the most basic actions you can perform on the Web is downloading a single Web page or document. First we’ll look at how to use the most commonly used Ruby HTTP library, net/http, before moving on to a few notable alternatives.
The net/http Library
The net/http library comes standard with Ruby and is the most commonly used library to access Web sites. Here’s a basic example:

require 'net/http'
url = URI.parse('')
Net::HTTP.start(, url.port) do |http|
  req =
  puts http.request(req).body