Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by all
First, check your PHP file with this code and then enable the fopen in your php.ini file
<?php
if( ini_get('allow_url_fopen') ) {
die('allow_url_fopen is enabled. file_get_contents should work well');
} else {
die('allow_url_fopen is disabled. file_get_contents would not work');
}
?>
Edit the php.ini file and enable using below code
allow_url_fopen = 1 //0 for Off and 1 for On Flag
allow_url_include = 1 //0 for Off and 1 for On Flag
- Login to your Cpanel
- Under Software click on MultiPHP INI Editor demo
- Click on Editor Mode and select Domain demo
- Paste allow_url_fopen = 1 and save
This solution worked for me as I couldn't access the php.ini file.
I added this function:
function curl_get_file_contents($URL)
{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c);
curl_close($c);
if ($contents) return $contents;
else return FALSE;
}
and use it instead of
file_get_contents($url)
and it worked.
The solution is better explained here, all credits to the creator of the post.