Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
HTTPS GET using SSL/TLS
See more HTTP Examples
To retrieve a resource using SSL/TLS (i.e. HTTPS), simply use a URL that begins with "https://". (This applies to any Chilkat HTTP method that has a URL argument, such as QuickGetStr, GetHead, QuickDeleteStr, etc.)Chilkat Pascal (Lazarus/Delphi) Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.Http;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
http: THttp;
html: string;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := THttp.Create;
// Send the HTTP GET and return the content in a string.
html := http.QuickGetStr('https://www.chilkatsoft.com/helloWorld.json');
if (http.LastMethodSuccess = False) then
begin
WriteLn(http.LastErrorText);
Exit;
end;
WriteLn(html);
http.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.