Skip to content

Instantly share code, notes, and snippets.

@shunwen
Created June 23, 2013 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shunwen/5846964 to your computer and use it in GitHub Desktop.
Save shunwen/5846964 to your computer and use it in GitHub Desktop.
How to visit an url in Ruby
# Not suitble for production
require 'open-uri'
open('http://github.com')
require 'net/http'
require 'uri'
uri = URI.parse "http://github.com/"
response = Net::HTTP.get_response uri
# Use system call
`curl http://github.com`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment