procedure PostData;
var
http : TIdHTTP;
Source:
string;
CookieMgr: TIdCookieManager;
PostParams: TIdMultiPartFormDataStream;
const
AddPageURL = '
http://www2.motoscout24.de/ger/private/privateeditmoto.asp';
begin
CookieMgr := TIdCookieManager.Create(
nil);
http := TIdHTTP.Create(
nil);
http.CookieManager := CookieMgr;
http.Request.ContentType := '
text/html';
http.Request.AcceptCharSet := '
ISO-8859-1';
http.Request.AcceptLanguage := '
DE';
http.HandleRedirects := true;
PostParams := TIdMultiPartFormDataStream.Create;
PostParams.AddFormField('
ctst', '
yes');
PostParams.AddFormField('
make', '
13');
PostParams.AddFormField('
model', '
148');
PostParams.AddFormField('
category', '
16');
PostParams.AddFormField('
price', '
500');
PostParams.AddFormField('
send', '
Jetzt kostenlos inserieren');
PostParams.AddFormField('
pubstart', '
');
PostParams.AddFormField('
pubend', '
');
PostParams.AddFormField('
id', '
0');
PostParams.AddFormField('
language', '
ger');
PostParams.AddFormField('
action', '
save');
Source := http.Post(AddPageURL, PostParams);
with TStringList.Create
do
try
Text := Source;
SaveToFile('
C:\test.html');
finally
Free;
end;
PostParams.Free;
CookieMgr.Free;
http.Free;
end;