跳过循环file_get_contents的500个响应

Here's the deal... I'm running a bunch of URL's through a foreach loop. Each URL will pass through fil_get_contents() but some will return 500 errors (expected), I want to skip/ignore any 500 errors, that are returned, but still pull the data for the valid responses. I have this setup, but still getting errors for undefined index on those 500 responses.

foreach($a['response']['groups']['users']['name'] as $key => $values)
    {
    $id = $values['uname']['id'];
    $url = "http://thisurlimusing.com"."$id";
    $context = stream_context_create(array('http' => array('ignore_errors' => true),));
    $string = file_get_contents($url,false,$context);
    $array =  json_decode($string, true);
    print_r($array['specific']);        
    }

your trouble is caused by the ignore_errors (http) set to true. In that case file_get_contents returns the error response text.

The following lines will work:

$string = file_get_contents($url,false);
if ($string !== FALSE) {
    $array =  json_decode($string, true);
}