summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/fcl-web/examples/httpclient/httppost.pp
blob: 9ecc3b1c08f5a9781295324537c5d06d735e40a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
program httppost;

{$mode objfpc}{$H+}

uses
  SysUtils, Classes, fphttpclient;

Var
  F : TFileStream;
  Vars : TStrings;
  i : integer;
begin
  With TFPHTTPClient.Create(Nil) do
    begin
    F:=TFileStream.Create('response.html',fmCreate);
    try
      Vars:=TstringList.Create;
      try
        For i:=1 to 10 do
          Vars.Add(Format('Var%d=Value %d',[i,i]));
        FormPost(ParamStr(1),vars,f);
      finally
        Vars.Free;
      end;
    finally
      F.Free;
    end;
    end;
end.