Downloading form HTTPS lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- jts · 2021-06-04 14:20 Hello, Thats my first post, but I did some research before posting. I need function (or procedure, whatever). I installed synapse, and INDY 10, I'm using Delphi 7. Searched here and there and I modyfied this code posts: click There's no problem whet url is just standard HTTP, but when its HTTPS it give 500 code. I add ssl_openssl, ssl_openssl_lib to uses, as was adviced at some thread at this forum. (Can't find it right now) Can anyone help me out and modify this code for HTTPS to works? Code: [Select]uses   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,   Dialogs, StdCtrls, httpsend, IdHTTP, IdStack, ssl_openssl, ssl_openssl_lib ; function pobierzzsieci(URL: string; FileName: string): boolean; var   httpClient: THTTPSend;   noErrors: boolean;   Path: string; begin   noErrors:= True;   httpClient := THTTPSend.Create;   if httpClient.HTTPMethod('GET', URL) then   begin     // for windows     FileName := StringReplace(FileName, '/', '\',[rfReplaceAll, rfIgnoreCase]);     Path := IncludeTrailingPathDelimiter(GetCurrentDir) + FileName;     if httpClient.ResultCode = 200 then       begin         if not DirectoryExists(ExtractFilePath(Path)) then  ForceDirectories(ExtractFilePath(Path));         httpClient.Document.SaveToFile(path);       end     else         noErrors := False;     end     else     begin       showmessage('something wrong code other than 200');       noErrors := False;     end;   Result := noErrors;   //Result:=httpClient.ResultCode ;   httpClient.Free; end; And Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var url3: string; plik: string; begin plik:='aaa\nowy\testowy\plik001.jpg'; url3:='https://kurdubelski.pl/images/avatar.jpg';  if pobierzzsieci(url3,plik) then  label1.Caption:='pobrano '+url  else showmessage('theres no such file');                                             end; ---------------------------------------------------------------------- paweld · 2021-06-04 15:30 there must be files in the application directory (or Windows directory): - ssleay32.dll - libeay32.dll https://github.com/IndySockets/OpenSSL-Binaries ---------------------------------------------------------------------- jts · 2021-06-04 15:59 I downloaded and copy to (both) Windows and programm directories. Nothing changed. EDIT: It worked. Just need to copy to System 32 AND to SysWOT64 thanks. ---------------------------------------------------------------------- trev · 2021-06-07 08:54 Alternatively, forget about OpenSSL DLLs and use Window's built-in routines: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$IFDEF WINDOWS}// Need to use Windows WinInet to avoid issue with HTTPS// needing two OpenSSL DLLs to be provided with application// if using TFPHttpClient.// The WinINet API also gets any connection and proxy settings// set by Internet Explorer. Blessing or curse? function GetWebPage(const Url: string): string;var  NetHandle: HINTERNET;  UrlHandle: HINTERNET;  Buffer: array[0..1023] of Byte;  BytesRead: dWord;  StrBuffer: UTF8String;begin  Result := '';  BytesRead := Default(dWord);  NetHandle := InternetOpen('Mozilla/5.0(compatible; WinInet)', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);   // NetHandle valid?  if Assigned(NetHandle) then    Try      UrlHandle := InternetOpenUrl(NetHandle, PChar(Url), nil, 0, INTERNET_FLAG_RELOAD, 0);       // UrlHandle valid?      if Assigned(UrlHandle) then        Try          repeat            InternetReadFile(UrlHandle, @Buffer, SizeOf(Buffer), BytesRead);            SetString(StrBuffer, PAnsiChar(@Buffer[0]), BytesRead);            Result := Result + StrBuffer;          until BytesRead = 0;        Finally          InternetCloseHandle(UrlHandle);        end      // o/w UrlHandle invalid      else        ShowMessage('Cannot open URL: ' + Url);    Finally      InternetCloseHandle(NetHandle);    end  // NetHandle invalid  else    raise Exception.Create('Unable to initialize WinInet');end;{$ENDIF} ---------------------------------------------------------------------- BeniBela · 2021-06-14 14:24 Or with my internet tools to use these Window's  routines on Windows and Synapse/OpenSSL everywhere else. Then it needs no DLLs there, but is still portable Code: [Select]uses simpleinternet; retrieve('https://kurdubelski.pl/images/avatar.jpg')