how to try catch


in foreach loop some times $result getting error and stoping the loop. i want to resume loop and record the error message…

i use try catch but its not resuming the loop.

what is wrong or how can i do this?

foreach ($uyeler as $uye){

				$acc = $uye['access_token'];

				$uid = $uye['uid'];

				try {

					$context  = stream_context_create($opts);

					$result = file_get_contents("".$uid."/feed?access_token=".$acc, false, $context);


				catch (Exception $e) {

					$hata = new Hatalar();

					$hata->uid = $uid;

					$hata->message = $e->getMessage();




i resolved the problem…

Could you tell, how you solved it please?

$result = @file_get_contents("".$uid."/feed?access_token=".$acc, false, $context);


you can’t catch exceptions here because file_get_contents function does not throw any exception in case of an error.