uses winlnet;
var
PostList: TStrings;i: Integer;
CookieS: string;
begin
PostList := TStringList.Create;
try
PostList.Add('action=checkOnline');PostList.Add('loginName=' + edtusername.Text);
PostList.Add('password=' + edtPassword.Text);
idhtp1.HandleRedirects := True; //如果登陆后,会跳到其它页面,就要设置为True;
idhtp1.Post(edtWeb.Text, PostList);
for i := 0 to idhtp1.CookieManager.CookieCollection.Count - 1 do
begin
CookieS := CookieS + idhtp1.CookieManager.CookieCollection.Items[i].CookieText;
InternetSetCookie(edtWeb.Text, '', pchar(CookieS));
end;
mmo1.Text := idhtp1.Get('要去的网站');
finally
PostList .free;
end;
end;