I'm getting JSON arrays with file_get_contents
, but if the page doesn't exist I want to give an message: Player not found. But now I get this error:
Warning: file_get_contents(urlwithan404errorhere) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in -------
I don't get this error when the api gives me an correct JSON array.
This is the code is use:
$gegevens = file_get_contents('');
$array_2 = json_decode($gegevens, TRUE);
$summonerid = $array_2[$naam]["id"];