Delphi Android使用idhttp.get抓取https(SSL)文件


本文整理自网络,侵删。

 
uses
 IdSSLOpenSSL,idhttp;
function HttpsAuthGet(Url, Username, Password: string):string;
var
  ssl: TIdSSLIOHandlerSocketOpenSSL;
  http: TIdHTTP;
begin
  http := TIdHttp.Create(nil);
  try
    ssl := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
    try
      http.IOHandler := ssl;
      http.Request.BasicAuthentication:=True;
      http.Request.Username := Username;
      http.Request.Password := Password;
      Result:=http.Get(Url);
      if (http.ResponseCode<200) or (http.ResponseCode>=300) then
        raise Exception.Create(http.ResponseText);
    finally
      FreeAndNil(ssl);
    end;
  finally
    FreeAndNil(http);
  end;
end;

相关阅读 >>

Delphi dbgrid查询内容的导出为txt函数

Delphi 删除文件函数支持撤销删除

Delphi android服务向导

Delphi 自带的字符串分割函数

Delphi里的compile和build都能产生可执行文件,有什么区别啊?

Delphi检测鼠标指针的改变(全局)

Delphi开发linux包

Delphi 暴力搜索api

Delphi 处理图片(剪切,压缩)

Delphi中interface接口的使用方法

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...