Recent

Author Topic: Open web page with redirect  (Read 929 times)

stansbkg

  • New Member
  • *
  • Posts: 21
Open web page with redirect
« on: October 04, 2022, 06:19:20 pm »
I'm trying to use Client.Get to scrape web data, with the ability to redirect. I created a test program (attached), which I drew from [ https://forum.lazarus.freepascal.org/index.php?topic=58637.0 ]. Why do I get the following error message?

Running "c:\fpc\3.2.2\bin\i386-win32\kgs storage\atestclientget.exe "
An unhandled exception occurred at $00425AE5:
EInOutError: Could not initialize OpenSSL library

dje

  • Full Member
  • ***
  • Posts: 124
Re: Open web page with redirect
« Reply #1 on: October 05, 2022, 08:30:05 am »
Sounds like you are missing the required SSL DLL's

Thaddy

  • Hero Member
  • *****
  • Posts: 12208
Re: Open web page with redirect
« Reply #2 on: October 05, 2022, 12:14:40 pm »
Or the wrong versions.
What is your compiler: 64 or 32 bit?
BTW: this is a recurring problem and the correct answers are all over this forum.
Manuals, manuals, manuals first.
You have incompetence and sheer incompetence.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1149
Re: Open web page with redirect
« Reply #3 on: October 05, 2022, 01:10:55 pm »
Hello,
Running "c:\fpc\3.2.2\bin\i386-win32\kgs storage\atestclientget.exe "
An unhandled exception occurred at $00425AE5:
EInOutError: Could not initialize OpenSSL library
try to see if you have the dll   ssleay32.dll in the folder Windows\system32  (for 64 bits) or Windows\Syswow64 ( for 32 bits) . You can also search for the other dlls of this code :
 
Code: Pascal  [Select][+][-]
  1. {$IFDEF WINDOWS}
  2.   DLLSSLName: string = 'ssleay32.dll';
  3.   DLLSSLName2: string = 'libssl32.dll';
  4.   DLLSSLName3: string = {$IFDEF WIN64}'libssl-1_1-x64.dll'{$ELSE}'libssl-1_1.dll'{$ENDIF};
  5.   DLLUtilName: string = 'libeay32.dll';
  6.   DLLUtilName2: string = {$IFDEF WIN64}'libcrypto-1_1-x64.dll'{$ELSE}'libcrypto-1_1.dll'{$ENDIF};
  7.   {$ELSE}      

« Last Edit: October 05, 2022, 01:15:03 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

stansbkg

  • New Member
  • *
  • Posts: 21
Re: Open web page with redirect
« Reply #4 on: October 07, 2022, 08:31:35 pm »
I don't have any of those XX.dlls. Should they have been loaded when I installed Free Pascal? Also, where can I find what I need?

dje

  • Full Member
  • ***
  • Posts: 124
Re: Open web page with redirect
« Reply #5 on: October 08, 2022, 12:35:45 am »
I don't have any of those XX.dlls. Should they have been loaded when I installed Free Pascal? Also, where can I find what I need?

Everything is documented:
https://wiki.lazarus.freepascal.org/fphttpclient#HTTPS_.28TLS.2FSSL.29

Which contains a link to:
https://wiki.openssl.org/index.php/Binaries

stansbkg

  • New Member
  • *
  • Posts: 21
Re: Open web page with redirect
« Reply #6 on: October 08, 2022, 08:21:58 pm »
How do I know what is the right openssl download to use? I have tried seven so far - only using those for 64 bit delphi applications, and all have failed with the same error message. I'm somewhat overwhelmed right now.

dje

  • Full Member
  • ***
  • Posts: 124
Re: Open web page with redirect
« Reply #7 on: October 08, 2022, 10:18:29 pm »
Maybe try the advice from here:
https://forum.lazarus.freepascal.org/index.php?topic=41401.0

They recommend the Indy SSL libs froms:
https://indy.fulgan.com/SSL/

Also, your filepath implies you are using FPC 32bit (ie: i386-win32)

Unsure if the 64bit versions will work.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1149
Re: Open web page with redirect
« Reply #8 on: October 09, 2022, 03:45:45 am »
Hello,
have a look  :o here : you have link to download files and explanation to install them :
Quote
32-bit and 64-bit Windows
To install OpenSSL in a 32-bit or 64-bit Windows, you need to copy the libeay32.dll and ssleay32.dll dynamic library files to your file system, you can download them from one of these locations:

Option 1 - Download the OpenSSL installer files and install them.
Option 2 - Download the OpenSSL compressed library files and copy the libeay32.dll and ssleay32.dll files to your system path.
If you go for Option 2 and decide to copy libeay32.dll and ssleay32.dll files to your system path, ensure you copy them to the right location:
32-bit Windows: You must copy the libeay32.dll and ssleay32.dll 32-bit files to your Windows system folder (System32 folder).
64-bit Windows: You must copy the libeay32.dll and ssleay32.dll 64-bit files to your Windows system folder for 64-bit files (System32) and the libeay32.dll and ssleay32.dll 32-bit files to your Windows 32-bit files folder (SysWOW64 folder).
So when working with a 64-bit Windows, remember:
System32 folder is for 64-bit files only.
SysWOW64 folder is for 32-bit files only.

it seems that you use Lazarus 32 bits on  a 64 bits Windows, so the 32 bits version of the dll's must be install in the folder SysWow64.

Friendly, J.P
« Last Edit: October 09, 2022, 03:50:57 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

 

TinyPortal © 2005-2018