我有一系列电话号码,我正在循环并向其发送短信。
偶尔会有一个数字无效,Twilio会抛出错误。我知道我可以在catch中注释掉echo但是如果仍然抛出异常,我需要继续循环。我应该完全删除try catch吗?
foreach($filterphones as $key => $value){
$account_sid = 'xxx';
$auth_token = 'xxx';
$client = new Services_Twilio($account_sid, $auth_token);
try {
$message = $client->account->messages->create(array(
'From' => "+16XXXXXXXXX",
'To' => $value,
'Body' => $body,
));
}catch (Services_Twilio_RestException $e) {
//echo $e->getMessage();
}
}