TFPHTTPClient是FreePascal中的web包中的类,这个类实现了一般的Http功能,比如对站点的访问、下载等,使用方法比较简单,它也可以访问https网站,但是需要用OpenSSL!!
TFPHTTPClient的演示例子:
http://lazplanet.blogspot.com/2019/03/how-to-get-contents-of-url-in-2-ways.html
直接下载:
https://drive.google.com/uc?export=download&id=1lGFBapcyiRWhMgJ6CXBl4nlzm2tEdwIa
https://www.dropbox.com/s/b6nzuecc2htw136/DownloadContent.zip?dl=1
这个例子下载之后,里面的libeay32.dll和ssleay32.dll好像有问题,直接运行exe程序,访问https网站,会报错,错误提示:could no initialize OpenSSL
解决方法:
用indy的OpenSSL替换掉它们。
indy的OpenSSL下载地址:
X86:https://indy.fulgan.com/SSL/Archive/Experimental/openssl-1.0.2o-x32-VC2017.zip
X64:https://indy.fulgan.com/SSL/Archive/Experimental/openssl-1.0.2o-x64-VC2017.zip
参考:
https://wiki.lazarus.freepascal.org/fphttpclient
https://forum.lazarus.freepascal.org/index.php?topic=41401.0