Sample code for 30+ languages & platforms
Ruby

Example: Http.GetServerCert method

Demonstrates how to call the GetServerCert method.

Chilkat Ruby Downloads

Ruby
require 'chilkat'

success = false

http = Chilkat::CkHttp.new()
cert = Chilkat::CkCert.new()

success = http.GetServerCert("chilkatsoft.com",443,cert)
if (success == false)
    print http.lastErrorText() + "\n";
    exit
end

print cert.subjectDN() + "\n";
print cert.validToStr() + "\n";

# Output:

# CN=*.chilkatsoft.com
# Wed, 10 Jun 2026 23:59:59 GMT