Delphi Idhttp的get和post方法

1.Get方法

idHttp1.Request.CustomHeaders.Text :=
  'Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*'+
  #13+#10+'Referer:http://url'+
  #13+#10+'Accept-Language: zh-CN' +
  #13+#10+'User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)'+
  #13+#10+'Accept-Encoding: gzip, deflate'+
  #13+#10+'Host: ***'+
  #13+#10+'Connection: Keep-Alive'+
  #13+#10+'Authorization: Basic *****=';
  IdHTTP1.get('http://url');




2.Post方法

var
  Param:TStringList;
  RStream:TStringStream;
begin
  Param:=TStringList.Create;
  RStream:=TStringStream.Create('');
  
  Param.Add('username=showlee000');
  Param.Add('normModPsp=********');
  Param.Add('mem_pass=true');
  IdHTTP1.Post('Http://URL',
              Param,RStream);

  memo1.Text:=RStream.DataString;



评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 邮件地址支持Gravatar头像,邮箱地址不会公开.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 关闭