PageRenderTime 12ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/fcl-web/examples/httpclient/httpget.pas

https://github.com/slibre/freepascal
Pascal | 27 lines | 21 code | 5 blank | 1 comment | 1 complexity | b64a5a9e75f8c9e790a7e56d0dd6e594 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
 1program httpget;
 2
 3{$mode objfpc}{$H+}
 4
 5uses
 6  SysUtils, Classes, fphttpclient;
 7
 8var
 9  i : Integer;
10
11begin
12  if (ParamCount<>2) then
13    begin
14    writeln('Usage : ',ExtractFileName(ParamStr(0)), 'URL filename');
15    Halt(1);
16    end;
17  With TFPHTTPClient.Create(Nil) do
18    try
19      Get(ParamStr(1),ParamStr(2));
20      Writeln('Response headers:');
21      For I:=0 to ResponseHeaders.Count-1 do
22        Writeln(ResponseHeaders[i]);
23    finally
24      Free;
25    end;
26end.
27