Skip to content

Instantly share code, notes, and snippets.

@stevenshelby
Created November 15, 2013 20:05
Show Gist options
  • Select an option

  • Save stevenshelby/7490734 to your computer and use it in GitHub Desktop.

Select an option

Save stevenshelby/7490734 to your computer and use it in GitHub Desktop.
def fetch_url(url)
r = Net::HTTP.get_response( URI.parse( url ) )
if r.is_a? Net::HTTPSuccess
r.body.force_encoding("UTF-8")
else
nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment