Created
June 23, 2013 23:44
-
-
Save shunwen/5846964 to your computer and use it in GitHub Desktop.
How to visit an url in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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