I created a REST API with wordpress to get some json data and this is the link is return all the data for me : https://alternativeviager.fr/wp-json/get-all-alternativeviager/v1/go
and from another domain i have another website made with wordpress also i create PHP script to get those data :
function file_contents($path) {
$str = @file_get_contents($path);
if ($str === FALSE) {
throw new Exception("Cannot access '$path' to read contents.");
} else {
return $str;
}
}
try {
$json_data = file_contents("https://alternativeviager.fr/wp-json/get-all-alternativeviager/v1/go");
var_dump($json_data);
} catch (Exception $e) {
// Deal with it.
echo "Error: " , $e->getMessage();
}
and i got this error instead :
Error: Cannot access 'https://alternativeviager.fr/wp-json/get-all-alternativeviager/v1/go' to read contents.
some help please
Thanks