(PHP Extension) Example: Http.GetLastJsonData method
Demonstrates the GetLastJsonData method. Note: This example requires Chilkat v11.0.0 or greater.
<?php
include("chilkat.php");
$success = false;
$http = new CkHttp();
$resp = new CkHttpResponse();
// 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 == false) {
print $http->lastErrorText() . "\n";
exit;
}
$json = new CkJsonObject();
$json->put_EmitCompact(false);
$http->GetLastJsonData($json);
print $json->emit() . "\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"
// }
// }
?>
|