Skip to content

Instantly share code, notes, and snippets.

@ehaughee
Created November 16, 2012 20:25
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 ehaughee/4090584 to your computer and use it in GitHub Desktop.
Save ehaughee/4090584 to your computer and use it in GitHub Desktop.
def send_index(index)
uri = URI.parse('http://127.0.0.1:4567/index')
# uri = URI.parse('http://serveit.herokuapp.com/index')
req = Net::HTTP::Post.new(uri.host)
req.body = index
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(req)
end
puts "Response #{res.code} #{res.message}: #{res.body}"
return
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment