Hallo
Anbei ein Beispiel, welches dir eine Idee zur Umsetzung geben können
(von experts-exchange.com)
Delphi-Quellcode:
procedure TForm1.SendPostData;
Var
aStream: TMemoryStream;
Params: TStringStream;
begin
aStream := TMemoryStream.create;
Params := TStringStream.create('
');
try
with IdHTTP1
do
begin
Params.WriteString(URLEncode('
teste=' + '
yes' + '
&'));
Params.WriteString(URLEncode('
name=' + '
ivan' + '
&'));
Params.WriteString(URLEncode('
number=' + '
102'));
Request.ContentType := '
application/x-www-form-urlencoded';
try
Post('
http://localhost/teste.asp', Params, aStream);
except
on E:
Exception do
showmessage('
Error encountered during POST: ' + E.
Message);
end;
end;
aStream.WriteBuffer(#0'
', 1);
aStream.Position := 0;
Memo1.Lines.LoadFromStream(aStream);
except
end;
// Finally: aStream.Free; Params.Free
end;