Autor Beitrag
jackie05
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Do 21.05.09 18:18 
Hallo,
ich versuche mich gerade über Delphi bei Rapidshare einzuloggen und als Test versuche ich den Seiten Quelltext auszulesen.

Hier mal mein Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.Button1Click(Sender: TObject);
var
  HTTP: TIdHTTP;
  Stream: TIdMultiPartFormDataStream;
  Quelltext: string;
begin
  HTTP := TIdHTTP.Create(nil);
  Stream := TIdMultiPartFormDataStream.Create;
  try
    Stream.AddFormField('login=',edtLogin.Text);
    Stream.AddFormField('password=',edtPassword.Text);
    Quelltext := HTTP.Post('https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi',Stream);
    Memo1.Text := Quelltext;
  except on E: Exception do
    ShowMessage(E.Message);
  end;
  HTTP.Free;
  Stream.Free;
end;


Wenn ich jetzt die Logindaten sende, erhalte ich folgende fehlermeldung:
Wert für IOHandler ist ungültig

Kann mir Vielleicht jemand helfen, wie ich das Problem lösen kann?

Ich bedanke mich schonmal im Voraus.

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 21.05.09 18:28 
Es fehlt die SSL-Einbindung. Das sind die entsprechenden beiden DLLs (libeay32.dll und ssleay32.dll glaube ich) von OpenSSL sowie die Erstellung und Zuweisung des entsprechenden IOHandlers TIdSSLIOHandlerSocketOpenSSL (ich hoffe richtig geschrieben, aber ist ja sehr kurz der Name :mrgreen:).

Dafür muss noch IdSSLOpenSSL in die uses. Zusätzlich musst du vielleicht auch noch Cookies annehmen und brauchst dafür TIdCookieManager in der Unit IdCookieManager.
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Do 21.05.09 19:00 
Ich danke Dir.

Ich habe die 2 DLLs, nur weiss ich nicht genau, wie ich das alles richtig einbinden und verwenden soll.
Kann mir das Vielleicht jemand erklären?

Danke schonmal.

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 21.05.09 19:13 
Naja, so ungefähr:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
  SSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create;
  CookieManager := TIdCookieManager.Create;
  IdHttpLoader := TIdHttp.Create;
  try
    IdHttpLoader.CookieManager := CookieManager;
    IdHttpLoader.IOHandler := SSLIOHandler;
    IdHttpLoader.HandleRedirects := True;
    ...
  finally
    IdHttpLoader.Free;
    CookieManager.Free;
    SSLIOHandler.Free;
  end;
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Do 21.05.09 19:22 
Ich danke Dir.

TIdSSLIOHandlerSocketOpenSSL ist Undefiniert.
IdSSLIOHandlerSocketOpenSSL kann ich auch nicht in die uses Klausel aufnehmen, da die IdSSLIOHandlerSocketOpenSSL.dcu nicht vorhanden ist.

Oder muss ich die beiden DLL Dateien in meinem Programm mit einbinden?

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 21.05.09 19:59 
user profile iconjaenicke hat folgendes geschrieben Zum zitierten Posting springen:
Dafür muss noch IdSSLOpenSSL in die uses.
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Do 21.05.09 20:42 
Das klappt ja soweit bis auf TIdSSLIOHandlerSocketOpenSSL.
IdSSLOpenSSL habe ich ja in die uses Klausel aufgenommen.

Beim Kompilieren bekomme ich diese Fehlermeldung:
[Fehler] Unit1.pas(41): Undefinierter Bezeichner: 'TIdSSLIOHandlerSocketOpenSSL'

Ich habe immer noch nicht diese 2 DLLs(libeay32.dll und ssleay32.dll) eingebunden, sind diese denn Wichtig?
Diese DLLs kann ich auch irgendwie nicht in Delphi einbinden, also Fehler beim laden des Typ Bibliotheks oder so.

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 21.05.09 20:52 
Welche Delphi-/Indyversion benutzt du denn? Ich bin von Indy 10 ausgegangen wie es ja bei Turbo Delphi dabei ist. Damit benutze ich das so. :gruebel:

Die DLLs werden davon ja benutzt, die müssen nur da sein.
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Do 21.05.09 21:21 
Ich benutze Delphi 7 Enterprise, keine ahnung welche Indy version dabei ist.
Ich denke mal, dass es sich bei mir um Indy 9 handelt.

Ich lade mir mal Indy 10 runter und Installiere es, mal kucken ob es funktioniert.

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 21.05.09 21:29 
Delphi 7 war sicherlich noch mit Indy 9, denn Delphi 7 ist ja nun ca. 8 Jahre alt. Wenn du die Komponenten dynamisch erstellst (wie ich es stets mache, u.a. damit auch jemand mit Turbo Delphi die Projekte nutzen kann), dann musst du nur die Pfade im Bibliothekspfad anpassen.
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: So 31.05.09 15:06 
Hallo und Sry das es solange gedauert hat, ich hatte wenig Zeit.

Ich habe jetzt Delphi 2005 und Indy version 10.0.52 Installiert und bekomme immer noch eine fehlermeldung:
IQHandler value is not valid

Irgendwie schaffe ich das nicht richtig mit der SSL Verbindung.

Kann mir da vielleicht jemand Helfen?

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 31.05.09 15:20 
Delphi 2005? Viel Spaß, wenn du wirklich das meinst und nicht Turbo Delphi. :lol:

Egal, ja der Fehler hieße, dass dass der IOHandler ungültig ist. Wie sieht dein Code denn jetzt aus?

Noch was ganz anderes, schau dir mal diesen Code an, SSL braucht man gar nicht, es geht auch viel einfacher:
www.delphipraxis.net...1041334.html#1041334
Und falls du die Downloadgeschwindigkeit zufällig auch beschränken willst:
www.delphi-forum.de/viewtopic.php?p=564192
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Mo 01.06.09 12:51 
Danke Dir.
Ich möchte mich nur in Rapidshare einloggen über Premium Account und nix runterladen.

Hier mal mein Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
procedure TForm1.btnLoginClick(Sender: TObject);
var
  Stream: TIdMultiPartFormDataStream;
  Quelltext: string;
  SSLIOHandler: TIdSSLIOHandlerSocket;
  HTTP: TIdHttp;
begin
  SSLIOHandler := TIdSSLIOHandlerSocket.Create(nil);
  HTTP := TIdHttp.Create(nil);

  HTTP.HandleRedirects := true;
  HTTP.IOHandler := SSLIOHandler;

  Stream := TIdMultiPartFormDataStream.Create;
  try
    Stream.AddFormField('login=',edtLogin.Text);
    Stream.AddFormField('password=',edtPassword.Text);
    Quelltext := HTTP.Post('https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi',Stream);
    Memo1.Text := Quelltext;
  except on E: Exception do
    ShowMessage(E.Message);
  end;
  Stream.Free;
  HTTP.Free;
  SSLIOHandler.Free;
end;


Wenn ich mich jetzt versuche einzuloggen, dann bekomme ich folgende fehlermeldung:
SSL.-Bibliothek konnte nicht geladen werden.

Die 2 DLLs befinden sich im Delphiverzeichnis lib und da wo sich meine .exe Datei befindet.

Woran liegt denn jetzt der fehler?

Danke schonmal.

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 01.06.09 13:14 
Die müssen nur im Verzeichnis der Exe liegen. Aber stimmt, da war noch was. Ich glaube vorher:
ausblenden Delphi-Quelltext
1:
LoadOpenSSLLibrary;					
Und danach entsprechend Unload...

Das hatte ich vergessen, da ich das in meinem Projekt in den Hauptinitialisierungsthread gelegt hatte. Dadurch stand das weder im Hauptthread noch im Downloadthread. :oops:
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Mo 01.06.09 13:26 
Danke Dir.

Sry das ich nerve, aber ich weiss leider nicht, wie ich diese Library in meinem Projekt lade.

Hab hier im Forum mal nachgekuckt und in google, leider komme ich nicht weiter.

Könntest Du mir vielleicht erklären wie ich das ambesten lade?

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 01.06.09 13:43 
Damit geht es immer noch nicht? Mehr habe ich nicht gemacht als ich die bei mir eingebaut habe. :gruebel:
jackie05 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 357



BeitragVerfasst: Mo 01.06.09 13:51 
Ich weiss nicht was ich damit machen soll:
LoadOpenSSLLibrary;

Ich hab das mal beim Button Klick eingefügt und bekomme diese Meldung:
ausblenden Delphi-Quelltext
1:
[Fehler] Unit1.pas(51): Undefinierter Bezeichner: 'LoadOpenSSLLibrary'					


ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
procedure TForm1.btnLoginClick(Sender: TObject);
var
  Stream: TIdMultiPartFormDataStream;
  Quelltext: string;
  SSLIOHandler: TIdSSLIOHandlerSocket;
  HTTP: TIdHttp;
begin
  LoadOpenSSLLibrary;

  SSLIOHandler := TIdSSLIOHandlerSocket.Create(nil);
  HTTP := TIdHttp.Create(nil);

  HTTP.HandleRedirects := true;
  HTTP.IOHandler := SSLIOHandler;

  Stream := TIdMultiPartFormDataStream.Create;
  try
    Stream.AddFormField('uselandingpage','1');
    Stream.AddFormField('login=',edtLogin.Text);
    Stream.AddFormField('password=',edtPassword.Text);
    Quelltext := HTTP.Post('https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi',Stream);
    Memo1.Text := Quelltext;
  except on E: Exception do
    ShowMessage(E.Message);
  end;
  Stream.Free;
  HTTP.Free;
  SSLIOHandler.Free;

  LoadHTMLToWebbrowser(WebBrowser1,Memo1.Lines);
end;


Oder hab ich da was falsch verstanden?

MfG
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 01.06.09 13:58 
user profile iconjaenicke hat folgendes geschrieben Zum zitierten Posting springen:
Naja, so ungefähr:
ausblenden Delphi-Quelltext
1:
  SSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create;					
user profile iconjackie05 hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
[Fehler]  SSLIOHandler: TIdSSLIOHandlerSocket;
  HTTP: TIdHttp;
begin
  LoadOpenSSLLibrary;

  SSLIOHandler := TIdSSLIOHandlerSocket.Create(nil);
Wie soll es denn klappen, wenn du gar nicht OpenSSL benutzt...
Mit der Unit IdSSLOpenSSL, in der auch das Laden der Bibliothek definiert ist.
the-kecks
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Fr 05.06.09 16:08 
ich hab grad das selbe problem mit uploaded (siehe diesen thread) und das LoadOpenSSLLibrary geht bei mir nicht, da steht immernoch undefinierter bezeichner Loadopen...
code:
-FormCreate
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
var SSLIOHandler: TIdSSLIOHandlerSocket;
begin
  LoadOpenSSLLibrary //<-- undef. bezeichner
  SSLIOHandler := TIdSSLIOHandlerSocket.Create(nil);
  IdHTTP1.CookieManager := IdCookieManager1;
  IdHttp1.IOHandler := SSLIOHandler;
  IdHTTP1.HandleRedirects := true;
  IdHTTP1.Request.UserAgent := 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10';

-ButtonClick
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
begin
  [...]
  Params := TStringList.Create;
  try
    Params.Add('email=' + login);
    Params.Add('password=' + pw);
    try
      HTMLCode:=IdHTTP1.Post('http://uploaded.to/login', Params);
    except
      showmessage('Login fehlgeschlagen');
    end;
  finally
    Memo2.text:=HTMLCode;
    if pos('Login', HTMLCode) >0 then showmessage('Login fehlgeschlagen');
    Params.Free;
  end;
end;

code ist auch im anderen thread vermerkt

mfg
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 06.06.09 00:46 
Und auf dich trifft genauso mein letzter Thread zu... du benutzt OpenSSL doch gar nicht...