delphi的idhttp的get 和 post的使用
2014-12-21 17:31
190 查看
function Tform1.IdHttpInit; begin idhtp1.AllowCookies:=True; idhtp1.HTTPOptions:=[hoForceEncodeParams]; idhtp1.ProtocolVersion:=pv1_1; idhtp1.Request.ContentType:='Content-Type=application/x-www-form-urlencoded; charset=UTF-8'; idhtp1.Request.CacheControl:='no-cache'; idhtp1.Request.UserAgent:='User-Agent=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)'; idhtp1.Request.Accept:='Accept=*/*'; idhtp1.Request.AcceptEncoding:='Accept-Encoding=gzip,deflate'; idhtp1.Request.AcceptCharSet:='Accept-Charset=gb2312,utf-8;q=0.7,*;q=0.7'; idhtp1.Request.Connection:='Connection=keep-alive'; idhtp1.Request.Host:='Host=kyfw.12306.cn'; idhtp1.Request.Referer:='https://kyfw.12306.cn/otn/login/init'; idhtp1.Request.AcceptLanguage:='Accept-Language=zh-cn'; Result:=''; end; function Tform1.GetCodeImg; var url:string; response:TMemoryStream; jpg:TJPEGImage; begin response:=TMemoryStream.Create; url:='https://kyfw.12306.cn/otn/passcodeNew/getPassCodeNew?module=login&rand=sjrand&0.3110086616057921'; idhtp1.Get(url,response); jpg:=TJPEGImage.Create; jpg.LoadFromStream(response); Result:=''; end; function Tform1.Login; var url : string; Params:TStrings; begin Params:=TStringList.Create; Params.Add('loginUserDTO.user_name=xxxxxx@qq.com');//用户名 Params.Add('userDTO.password=xxxxxxx');//密码 Params.Add('randCode=ku6a');//验证码 Params.Add('randCode_validate='); Params.Add('OTcyNTU4=ZjIzYzc3MWJmMDk4OTk5YQ=='); Params.Add('myversion=undefined'); end;
相关文章推荐
- delphi的idhttp的get 和 post的使用
- delphi的idhttp的get 和 post的使用
- Delphi IDHTTP控件:GET/POST 请求
- Delphi IDHTTP控件:GET/POST 请求
- Delphi Idhttp的 Get 和 Post 方法
- Delphi Idhttp的get和post方法
- Delphi IDHTTP控件:GET/POST 请求
- 关于安全的建议:对投入使用的 XML Web Services 禁用 HTTP-GET 和 HTTP-POST 协议
- delphi idhttp 使用方法
- REST应该放弃使用http头GET、POST、PUT和DELETE来表达操作
- HTTP协议及POST与GET操作差异,C#中如何使用POST、GET等
- HTTP协议及其POST与GET操作差异 & C#中如何使用POST、GET等
- HTTP协议及其POST与GET操作差异 & C#中如何使用POST、GET等
- HTTP协议及其POST与GET操作差异 & C#中如何使用POST、GET等
- 使用HttpURLConnection开发自动发送Get、Post请求并获取响应
- HTTP协议及其POST与GET操作差异 & C#中如何使用POST、GET等
- HTTP协议及POST与GET操作差异,C#中如何使用POST、GET等
- 关于安全的建议:对投入使用的 XML Web Services 禁用 HTTP-GET 和 HTTP-POST 协议
- HTTP协议及其POST与GET操作差异 & C#中如何使用POST、GET等<转>
- HTTP协议中POST、GET、HEAD的区别是什么?分别在什么情况下使用?