delphi idhttp 使用方法
IdHTTP1.Request.Connection:='Keep-Alive';
IdHTTP1.Request.UserAgent:='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)';
IdHTTP1.Request.ContentType:='application/x-www-form-urlencoded';
IdHTTP1.Request.Referer:='http://www.xxx.com';
IdHTTP1.Request.Accept:='image/gif,
image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/msword, */*';
IdHTTP1.Request.AcceptLanguage:='zh-cn';
IdHTTP1.Request.AcceptEncoding:='gzip, deflate';
IdHTTP1.Request.CacheControl:='no-cache';
IdHTTP1.ReadTimeout:=60000;
IdHTTP1.HTTPOptions:=IdHTTP1.HTTPOptions+[hoKeepOrigProtocol];//关键这行
IdHTTP1.ProtocolVersion:=pv1_1;
sHtml:=IdHTTP1.Post('http://www.xxx.com/login.asp',sPost);
本文介绍了 Delphi 中 IdHTTP 组件的使用方法,通过设置不同的属性如 UserAgent 和 Accept 等,实现了一个完整的 POST 请求流程。文章详细展示了如何配置 IdHTTP 的各项参数,并通过一个具体的登录请求实例说明了其应用。
197

被折叠的 条评论
为什么被折叠?



