急求:使用idhttp登陆HTTS网站(100分)

  • 主题发起人 主题发起人 heman2000
  • 开始时间 开始时间
H

heman2000

Unregistered / Unconfirmed
GUEST, unregistred user!
如题!
如何POST数据到使用SSL协议的WEB站点。主要是要登陆的网站使用的是SSL协议。IdSSLIOHandlerSocketOpenSSL如何使用?我用的是INDY10
 
如何POST呢?
 
关注我顶,怎么没人来回答呢?
 
procedure TMM7Soap.DoRequest(const AMethod: TIdHTTPMethod; AURL: string;
const ASource, AResponseContent: TStream);
var
LProto: string;
OldHandler: TIdIOHandler;
{$ENDIF}
begin
{$IFDEF DELPHI6}
ProtocolVersion := Pv1_1;
ParseURI(AURL, LProto, LHost, LPath, LDoc, LPort, LBookmark);
{$ELSE}
Url.Uri := AURL;
LProto := Url.Protocol;
OldHandler := nil;
{$ENDIF}


if AnsiSameText(UpperCase(LProto), 'HTTPS') then //create https object
begin
{$IFDEF DELPHI6}
if Ssl = nil then
begin
Self.SSL := TIdConnectionInterceptOpenSSL.Create(nil);
end;
SSl.SSLOptions.Method := sslvSSLv23;
Self.Intercept := SSl;
Ssl.OnGetPassword := Self.SSLGetPassword;
Self.SocksInfo.Host := ''; //不支持同时使用socks和https
Self.SocksInfo.Port := 0;
Self.SocksInfo.Version := svNoSocks;
{$ELSE}
if Ssl = nil then
begin
Self.SSL := TIdSSLIoHandlerSocket.Create(nil);
Ssl.SocksInfo := nil;
end;
SSl.SSLOptions.Method := sslvSSLv23;
if (Self.IOHandler is TIdIOHandlerSocket) and
((Self.IOHandler as TIdIOHandlerSocket).SocksInfo <> nil) then
begin
// Ssl.SocksInfo := (Self.IOHandler as TIdIOHandlerSocket).SocksInfo;
// don't support
end;
OldHandler := Self.IOHandler;
Self.IOHandler := SSl;
Ssl.OnGetPassword := Self.SSLGetPassword;

{$ENDIF}
end
else
{$IFDEF DELPHI6}
Self.Intercept := nil;
{$ELSE}
Self.IOHandler := nil;
{$ENDIF}
try
inherited;
finally
{$IFNDEF DELPHI6}
if OldHandler <> nil then
Self.IOHandler := OldHandler;
{$ENDIF}
end;

end;
拷贝libeay32.dll和libeay32.dll
 
多人接受答案了。
 
后退
顶部