I am trying to make a simple file_get_contents(https://some.api) in my code, but, while the URL works in the browser, it doesn't in php. I always get the following error:
file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:0A000126:SSL routines::unexpected eof while reading
I already tried some suggestions from similar questions in Stack Overflown like using stream_context_create():
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$geoData = file_get_contents($requestUrl, false, stream_context_create($arrContextOptions));
But it still doesn't work. PHP SLL also seems to be ok:
~ » php -i | grep -i openssl user@localhost
SSL Version => OpenSSL/3.0.3
libSSH Version => libssh/0.9.6/openssl/zlib
libmongoc SSL library => OpenSSL
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 3.0.3 3 May 2022
OpenSSL Header Version => OpenSSL 3.0.2 15 Mar 2022
Openssl default config => /etc/pki/tls/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
Native OpenSSL support => enabled