file_get_contents doesnt work (https) anymore after upgrading to php 7 (from 5.5)

This is it

Verified User
Joined
Feb 12, 2017
Messages
27
Somehow file_get_contents doenst work anymore for https links, i disabled firewall and all wrappers seems fine to mee

allow_url_fopen: yes
openssl: yes
http wrapper: yes
https wrapper: yes
wrappers: array(11) { [0]=> string(5) "https" [1]=> string(4) "ftps" [2]=> string(13) "compress.zlib" [3]=> string(3) "php" [4]=> string(4) "file" [5]=> string(4) "glob" [6]=> string(4) "data" [7]=> string(4) "http" [8]=> string(3) "ftp" [9]=> string(4) "phar" [10]=> string(3) "zip" }

i tried this from stack overflow but doesnt work for mee
$url= 'https://example.com';

$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);

$response = file_get_contents($url, false, stream_context_create($arrContextOptions));


What is the next step?
 
Somehow file_get_contents doenst work anymore for https links, i disabled firewall and all wrappers seems fine to mee

allow_url_fopen: yes
openssl: yes
http wrapper: yes
https wrapper: yes
wrappers: array(11) { [0]=> string(5) "https" [1]=> string(4) "ftps" [2]=> string(13) "compress.zlib" [3]=> string(3) "php" [4]=> string(4) "file" [5]=> string(4) "glob" [6]=> string(4) "data" [7]=> string(4) "http" [8]=> string(3) "ftp" [9]=> string(4) "phar" [10]=> string(3) "zip" }

i tried this from stack overflow but doesnt work for mee
$url= 'https://example.com';

$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);

$response = file_get_contents($url, false, stream_context_create($arrContextOptions));


What is the next step?

If the URL you are using gets redirected file_get_contents tends to reset to defaults no matter what you enter for TLS version in stream_context. It's attempting SSLv3 very likely and the site you are attempting only allows more secure protocols (TLSv1.2, etc.)

I suggest you either revert to PHP 5.5 (5.6 has this same problem because file_get_contents was changed in 5.6: http://php.net/manual/en/migration56.openssl.php) or start using curl instead where you have more control over the connection.
 
Back
Top