how to try catch

hi,

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("https://graph.facebook.com/".$uid."/feed?access_token=".$acc, false, $context);

				}

				catch (Exception $e) {

					$hata = new Hatalar();

					$hata->uid = $uid;

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

					$hata->save();

				}




			}



i resolved the problem…

Could you tell, how you solved it please?


$result = @file_get_contents("https://graph.facebook.com/".$uid."/feed?access_token=".$acc, false, $context);

Hi,

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