How to get the HTML source of a webpage in Ruby [duplicate]

Use Net::HTTP:

require 'net/http'

source = Net::HTTP.get('stackoverflow.com', '/index.html')

Leave a Comment