Skip to content

Instantly share code, notes, and snippets.

@olistik
Created May 16, 2010 15:25
Show Gist options
  • Save olistik/402928 to your computer and use it in GitHub Desktop.
Save olistik/402928 to your computer and use it in GitHub Desktop.
require 'net/http'
module Http
def self.get(uri)
url = URI.parse uri
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) do |http|
http.request(req)
end
res.body
end
def self.post(uri, data)
res = Net::HTTP.post_form(URI.parse(uri), data)
res.body
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment