Ver Mensaje Individual
  #4  
Antiguo 10-04-2018
dosher81 dosher81 is offline
Registrado
 
Registrado: abr 2018
Posts: 8
Reputación: 0
dosher81 Va por buen camino
sigo con la locura, no hay forma de hacerlo funcionar.

el problema es que la pagina web donde quiero acceder es https, con lo que tengo que utilizar ssl y aqui choco contra una pared con la que ya chocaron compañeros del foro y con la que no he encontrado solución hasta la fecha.

pongo algo de código:

Código Delphi [-]
uses: IdMultipartFormData,IdSSLOpenSSL;

procedure Tfautoescuela.FormCreate(Sender: TObject);
var
IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL;
begin
///
 IdSSLIOHandlerSocketOpenSSL1 := TIdSSLIOHandlerSocketOpenSSL.Create(self);
  with idSSLIOHandlerSocketOpenSSL1 do
    begin
      SSLOptions.Method := sslvSSLv2;
      SSLOptions.Mode := sslmUnassigned;
      SSLOptions.VerifyMode := [];
      SSLOptions.VerifyDepth := 0;
      //host := '';
    end;
   IdHTTP1 := TIdHTTP.Create(Self);
  with IdHTTP1 do
    begin
      IOHandler := IdSSLIOHandlerSocketOpenSSL1;
      AllowCookies := True;
      ProxyParams.BasicAuthentication := False;
      ProxyParams.ProxyPort := 0;
      Request.ContentLength := -1;
      Request.ContentRangeEnd := 0;
      Request.ContentRangeStart := 0;
      Request.Accept := 'text/html, */*';
      Request.BasicAuthentication := False;
      Request.UserAgent := 'Mozilla/3.0 (compatible; Indy Library)';
      HTTPOptions := [hoForceEncodeParams];
    end;
End;

procedure Tfautoescuela.Button1Click(Sender: TObject);
var S: TStringList;
   M: TStream;
begin
 S := TStringList.Create;
 M := TMemoryStream.Create;
 try
   S.Values['nif'] := '455654654S';
   S.Values['fecha-exa'] := '04/01/2018';
   S.Values['tipo-exa'] := 'B';
   S.Values['fecha-nac'] := '18/02/1975';

   IdHTTP1.IOHandler := IdSSLIOHandlerSocketOpenSSL1;
   IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
   IdHTTP1.Post('https://aegranvia.es/resultados', S, M);
   Memo1.Lines.Add(Format('Response Code: %d', [IdHTTP1.ResponseCode]));
   Memo1.Lines.Add(Format('Response Text: %s', [IdHTTP1.ResponseText]));

   M.Position := 0;
   S.LoadFromStream(M);
   Memo1.Lines.AddStrings(S);
 finally
   S.Free;
   M.Free;
 end;

el problema es que TIdSSLIOHandlerSocketOpenSSL me dice undeclared identifier.

ya actualicé a indy10, he descarado las dll y sinceramente no se que mas le puedo hacer

¿se os ocurre algo?

mil gracias!!

Última edición por dec fecha: 10-04-2018 a las 09:23:28. Razón: Poner etiqueta DELPHI
Responder Con Cita