Ruby
Ruby
Example: Http.QuickGetSb method
Demonstrates theQuickGetSb method.
Chilkat Ruby Downloads
require 'chilkat'
success = false
http = Chilkat::CkHttp.new()
# Send the HTTP GET and return the content in a StringBuilder
sb = Chilkat::CkStringBuilder.new()
success = http.QuickGetSb("https://www.chilkatsoft.com/helloWorld.json",sb)
if (http.get_LastMethodSuccess() == false)
if (http.get_LastStatus() == 0)
# Communications error. We did not get a response.
print http.lastErrorText() + "\n";
else
print "Response status code: " + http.get_LastStatus().to_s() + "\n";
print "Response body error text:" + "\n";
print sb.getAsString() + "\n";
end
exit
end
# The downloaded content:
print sb.getAsString() + "\n";
print "Success" + "\n";