(Perl) Example: Http.GetLastJsonData method
Demonstrates the GetLastJsonData method. Note: This example requires Chilkat v11.0.0 or greater.
use chilkat();
$success = 0;
$http = chilkat::CkHttp->new();
$resp = chilkat::CkHttpResponse->new();
# Only allow TLS 1.2 or better.
$http->put_SslProtocol("TLS 1.2 or higher");
$success = $http->HttpNoBody("GET","https://google.com/",$resp);
if ($success == 0) {
print $http->lastErrorText() . "\r\n";
exit;
}
$json = chilkat::CkJsonObject->new();
$json->put_EmitCompact(0);
$http->GetLastJsonData($json);
print $json->emit() . "\r\n";
# 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"
# }
# }
|