Created
February 13, 2012 19:23
-
-
Save patelc75/1819335 to your computer and use it in GitHub Desktop.
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
def self.send(dest_url, content) | |
url = URI.parse(dest_url) | |
# Code snippet on how to use Net:HTTP: http://snippets.aktagon.com/snippets/305-Example-of-how-to-use-Ruby-s-NET-HTTP | |
http_endpoint = Net::HTTP.new(url.host, url.port) | |
if url.scheme == 'https' | |
http_endpoint.use_ssl = true | |
http_endpoint.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
#http_endpoint.verify_mode = OpenSSL::SSL::VERIFY_PEER #verify the certificate -- not working with Avantguard, getting "OpenSSL::SSL::SSLError: certificate verify failed" | |
end | |
request = Net::HTTP::Post.new(url.request_uri) | |
request.body = content | |
request.set_content_type("text/xml") | |
res = http_endpoint.start do |http| | |
http_endpoint.request(request) | |
end | |
return res | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment