Over a million developers have joined DZone.

Fetch A URL In Ruby

·
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*
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}