Last active
August 29, 2015 14:14
-
-
Save huezoaa/4104d1a70217bd051301 to your computer and use it in GitHub Desktop.
Ruby Curl
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
require 'httparty' | |
# puts ARGV | |
# p ARGV | |
#### Hint: When you pass arguments to Ruby through the Command Line, | |
#### they get set into a Constant Array variable named ARGV. | |
case ARGV[0] | |
when "GET" | |
url = "http://" + ARGV[1] | |
# puts url | |
response = HTTParty.get("#{url}") | |
puts response.headers | |
puts response.body | |
end | |
# puts ARGV[0] | |
# puts ARGV[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment