unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP;
type
TForm1 =
class(TForm)
IdHTTP1: TIdHTTP;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
Function SendPostData(Ahttp:TIdHttp;
Const AtoURL:
String;
const aParams: TStrings) :
String;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Function TForm1.SendPostData(Ahttp:TIdHttp;
Const AtoURL:
String;
const aParams: TStrings):
String;
var lStream:TMemoryStream;
lParams: TStringStream;
I:Integer;
BEGIN
result :='
';
if not assigned(aHTTP)
then exit;
lStream := TMemoryStream.Create;
lParams := TStringStream.Create('
');
TRY
AHttp.Request.ContentType := '
application/x-www-form-urlencoded';
for i := 0
to aParams.Count-1
Do
lParams.WriteString(aParams[I]+'
&');
TRY
aHttp.Post(AtoURL, lParams, lStream)
except
on E:
Exception do Showmessage ('
Fehler bei der Übertragung: ' + E.
Message);
END;
SetLength(Result,lStream.Size);
lStream.Position := 0;
lStream.ReadBuffer(Result[1],lStream.Size);
finally
lParams.Free;
lStream.Free;
END;
END;
procedure TForm1.Button1Click(Sender: TObject);
var sList: TStringList;
begin
sList := TStringList.Create;
try
sList.Add('
sid=325806239433722059');
sList.Add('
onr=4880911920');
sList.Add('
logd=32580');
sList.Add('
aufdat=26.06.06');
sList.Add('
frankatur=03');
sList.Add('
warenwert=1000,00');
sList.Add('
wwcurr=EUR');
sList.Add('
termart=F');
sList.Add('
terdat=26.10.06');
sList.Add('
nachnahme=2000');
sList.Add('
nncurr=EUR');
sList.Add('
txid=036190');
sList.Add('
ename1=Thomas Göttsching');
sList.Add('
ename2=');
sList.Add('
estr=Teststrasse1');
sList.Add('
eland=DE');
sList.Add('
eplz=32369');
sList.Add('
eort=Rahden');
sList.Add('
vtext=AVIS');
sList.Add('
etext=Tel-Nr');
sList.Add('
cca1=1');
sList.Add('
ccv1=FP');
sList.Add('
cci1=Panasonic TV');
sList.Add('
gew=60');
sList.Add('
gesdcbm=0');
sList.Add('
geslm=0,00');
sList.Add('
delcode=00');
sList.Add('
inarg=');
{Memo1.Text := SendPostData(idHttp1,'http://212.184.95.90/cgi-bin/or?ostore.php',sList);}
Memo1.Text := idhttp1.Post('
http://212.184.95.90/cgi-bin/or?ostore',slist);
finally
slist.Free;
END;
end;
end.