Sample code for 30+ languages & platforms
Tcl Requires Chilkat v11.0.0+

Example: Http.GetLastJsonData method

Demonstrates the GetLastJsonData method.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set http [new_CkHttp]

set resp [new_CkHttpResponse]

#  Only allow TLS 1.2 or better.
CkHttp_put_SslProtocol $http "TLS 1.2 or higher"

set success [CkHttp_HttpNoBody $http "GET" "https://google.com/" $resp]
if {$success == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkHttpResponse $resp
    exit
}

set json [new_CkJsonObject]

CkJsonObject_put_EmitCompact $json 0

CkHttp_GetLastJsonData $http $json
puts [CkJsonObject_emit $json]

#  Output as of Chilkat v11.1.0
#  Additional information may be added as requested or needed in future versions of Chilkat.

#  {
#    "tls": {
#      "params": {
#        "sniHostname": "www.google.com",
#        "allowConnectionOnlyIfServerChooses": "TLS 1.2 or higher"
#      },
#      "negotiatedTlsVersion": "TLS 1.3"
#    }
#  }

delete_CkHttp $http
delete_CkHttpResponse $resp
delete_CkJsonObject $json