PHP Requires Chilkat v11.0.0+
Chilkat2 PHP
Example: Http.GetLastJsonData method
Demonstrates theGetLastJsonData method.
Chilkat PHP Downloads
<?php
use Chilkat2\Http;
use Chilkat2\HttpResponse;
use Chilkat2\JsonObject;
$http = new Http();
$resp = new HttpResponse();
// Only allow TLS 1.2 or better.
$http->SslProtocol = 'TLS 1.2 or higher';
try {
$http->HttpNoBody('GET', 'https://google.com/', $resp);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
$json = new JsonObject();
$json->EmitCompact = false;
$http->GetLastJsonData($json);
echo $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"
// }
// }