First things first: nesting
file_get_contents() is almost never the right way to solve a problem.
In English, what your code is doing is:
- Read the contents of a local file
- Treat the contents of that file as a path
- Read the contents of the referenced file
This implies that the path you are trying to fetch is persistent, and changes over time. While this is not technically invalid, it's almost certainly a symptom of a bad application design, where a database would be a more appropriate solution,
The next thing to note is without a fully qualified URL (including the scheme and domain) you path is referencing something on the local file system, relative to the current working directory and - crucially - query strings like
?alls do not work on the local file system. In the context you are most likely trying to use it (
$_GET) this is a construct of the HTTP protocol.
If you are trying to load some JSON from a remote server, you need to set up your code like this:
$json = file_get_contents('http://remotedomain.com/path/to/file.json');
$object = json_decode($json);
// do stuff with object