I have a server online with 2 domain, both with SSL by letsencrypt
On domain A, I have created a file with json content that I can read from my pc with this code
$url = 'https://www.domainA.com/feed.php';
$response = file_get_contents($url, true);
$obj = json_decode($response, true);
print_r($obj);
When I upload this file on domainB, I get this
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in ...
Warning: file_get_contents(): Failed to enable crypto in ...
Warning: file_get_contents(https://www.domainA.com/feed.php): failed to open stream: operation failed in ...
EDIT
Same problem with this code
$url = 'https://www.domainA.com/feed.php';
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$result = file_get_contents($url, false, stream_context_create($arrContextOptions));
Response is
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in ...
Also with this CURL code
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
print_r($result);
$obj = json_decode($result, true);
print_r($obj);
i have
The requested URL returned error: 404 Not Found