(Unicode C++) Example: Http.GetLastJsonData method
Demonstrates the GetLastJsonData method. Note: This example requires Chilkat v11.0.0 or greater.
#include <CkHttpW.h>
#include <CkHttpResponseW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
bool success = false;
CkHttpW http;
CkHttpResponseW resp;
// Only allow TLS 1.2 or better.
http.put_SslProtocol(L"TLS 1.2 or higher");
success = http.HttpNoBody(L"GET",L"https://google.com/",resp);
if (success == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
CkJsonObjectW json;
json.put_EmitCompact(false);
http.GetLastJsonData(json);
wprintf(L"%s\n",json.emit());
// 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"
// }
// }
}
|