核心代码贴给你 function GetPage( url,lasturl,encoding: string ) : string ; const Agent:string='Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; CIBA; MAXTHON 2.0)'; var browserTimeout:Integer; begin browserTimeout := 60*1000; try begin Form1.idhtp1.Request.ContentType := 'application/x-www-form-urlencoded'; Form1.idhtp1.request.Method := hmGET; Form1.idHTP1.AllowCookies := True; Form1.idhtp1.request.Referer := lasturl; Form1.idhtp1.request.Expires := browserTimeout; //Form1.idhtp1.request.AllowAutoRedirect := true; Form1.idhtp1.request.UserAgent := Agent; if encoding<>'' then Form1.idhtp1.Request.AcceptEncoding:=encoding; Result:=Form1.idhtp1.Get(url); end; except begin end; end; end;//提交表单 parmas格式如 parmas.add('userid=aaa');parmas.add('password=asdf');function postPage(posturl,lasturl,encoding:string; Params: TStrings):string ;var HTML: String;begin try Form1.idhtp1.Request.UserAgent :='Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; CIBA; MAXTHON 2.0)'; Form1.idhtp1.Request.Method:=hmPost; Form1.idhtp1.Request.ContentType := 'application/x-www-form-urlencoded'; Form1.idHTP1.AllowCookies := True; Form1.idhtp1.request.Referer := lasturl; Form1.idhtp1.request.Expires := 60*1000; if encoding<>'' then begin Form1.idhtp1.Request.AcceptEncoding:=encoding; Form1.idhtp1.Response.ContentEncoding:=encoding; end; HTML:=Form1.IdHtp1.Post(postURL,Params); Result :=html; finally Params.Free; end;end;