idhttpserver如何得到提交的表单的内容?(100)

  • 主题发起人 主题发起人 bo717
  • 开始时间 开始时间
B

bo717

Unregistered / Unconfirmed
GUEST, unregistred user!
有没有办法得到?
 
原来真的是在commandget里的Arequestinfo.Params里,解决了,准备散分,早回复者有分
 
我也想了解下。代码贴贴帮助后人
 
核心代码贴给你 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;
 
多人接受答案了。
 
后退
顶部