Sample code for 30+ languages & platforms
Ruby

HTTP Post XML

Demonstrates how to POST XML to a website.

Chilkat Ruby Downloads

Ruby
require 'chilkat'

success = false

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

http = Chilkat::CkHttp.new()

# Make sure to replace the URL with something real...
url = "https://example.com/example.asp"
xmlBody = "<test>This is the XML to be sent</test>"
resp = Chilkat::CkHttpResponse.new()
success = http.HttpStr("POST",url,xmlBody,"utf-8","application/xml",resp)
if (success == false)
    print http.lastErrorText() + "\n";
    exit
end

# Examine the body of the response.
print resp.bodyStr() + "\n";