The
file_get_contents[
^] method reads the contents of the specified file. It does
not execute the code stored in that file.
Your file contents are PHP script, not JSON.
If you want to execute the PHP script and load the result, you will need to specify the complete URL to the script. You cannot use a relative URL, since that will be interpreted as a file path.
$json = file_get_contents('https://www.yoursite.local/url/file/json.php');
If that still doesn't work, then you need to debug your code to examine the contents of the
$json
variable.