function StringToPostData( Str:
String):OleVariant;
var
i,l:Integer;
PostDataArray:Variant;
begin
l:=Length( Str);
PostDataArray:=VarArrayCreate([0,l-1],varByte);
for i:=0
to l-1
do
PostDataArray[i]:=Byte( Str[i+1]);
Result:=PostDataArray;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
URL: WideString;
Flags,TargetFrameName,PostData, Header: OleVariant;
begin
URL:='
http://127.0.0.1:80';
PostData:=StringToPostData('
PostData blablabla...'#13#10'
und noch was...');
Header:='
Content-Type: application/x-www-form-urlencoded'#13#10;
WebBrowser1.Navigate(
URL,Flags,TargetFrameName,PostData, Header);
end;
procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
memo1.lines.add((ARequestInfo.PostStream
AS TStringStream).DataString);
end;
procedure TForm1.IdHTTPServer1CreatePostStream(ASender: TIdPeerThread;
var VPostStream: TStream);
begin
VPostStream:=TStringStream.Create('
');
end;