Lua
Lua
Example: Http.QuickGetSb method
Demonstrates theQuickGetSb method.
Chilkat Lua Downloads
local chilkat = require("chilkat")
local http = chilkat.Http.new()
-- Send the HTTP GET and return the content in a StringBuilder
local sb = chilkat.StringBuilder.new()
local success = http:quick_get_sb("https://www.chilkatsoft.com/helloWorld.json", sb)
if not http.last_method_success then
if http.last_status == 0 then
-- Communications error. We did not get a response.
print(http.last_error_text)
else
print("Response status code: " .. http.last_status)
print("Response body error text:")
print(sb:get_as_string())
end
return
end
-- The downloaded content:
print(sb:get_as_string())
print("Success")