I solved it in XAMPP by uncommenting ;extension=php_openssl.dll
in /apache/bin/php.ini
despite phpinfo() telling me /php/php.ini
was the loaded ini file.
EDIT: I guess Ezra answer is the best solution directly adding the extension line to the appropriate ini file.
I had to add extension=php_openssl.dll
to my php.ini
file located in xampp/php/php.ini
. Somehow it was not there, after adding it and restarting Apache everything was working fine.
just add two lines in your php.ini file.
extension=php_openssl.dll
allow_url_include = On
its working for me.
Your Apache is probably not compiled with SSL support. Use cURL instead of file_get_contents anyway. Try this code, if it fails then I am right.
function curl_get_contents($url)
{
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
$data = curl_exec($curl);
curl_close($curl);
return $data;
}
I have enable the openssl extention and it work for me :)
;extension=php_openssl.dll
to
extension=php_openssl.dll
In my case (PHP 7.3 on Windows in FastCGI mode) it was uncommenting extension=openssl
.
Not extension=php_openssl, as most people post here.
(The same thing was posted here, but without details on OS which may be a key difference here.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With