Skip to content

Instantly share code, notes, and snippets.

@rx
Created May 29, 2009 13:19
Show Gist options
  • Save rx/119945 to your computer and use it in GitHub Desktop.
Save rx/119945 to your computer and use it in GitHub Desktop.
def post_xml( xml, path)
url = URI.parse("http://[login]:[password]@[domain]/#{path}")
req = Net::HTTP::Post.new(url.path)
userinfo = url.userinfo.split(':')
req.basic_auth(userinfo[0], userinfo[1])
req['Content-Type'] = "text/xml"
req.body = xml
@response = Net::HTTP.start(url.host, url.port) do |http|
http.request(req)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment