Sample code for 30+ languages & platforms
Lua

Send HTTPS Get Without Waiting for the Response

See more REST Examples

This example demonstrates sending an HTTP GET request without waiting for the response.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

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

local rest = chilkat.Rest.new()

-- Connect to the server using TLS
local bAutoReconnect = false
local success = rest:connect("example.com", 443, true, bAutoReconnect)
if not success then
    print(rest.last_error_text)
    return
end

-- Send a GET request to https://example.com/some/path
success = rest:send_req_no_body("GET", "/some/path")
if not success then
    print(rest.last_error_text)
    return
end

-- OK, the request was sent.
-- Close the connection.
local maxWaitMs = 50
rest:disconnect(maxWaitMs)

print("GET Request Sent.")