I have an array of phone numbers which I am looping over and sending a text message to.
Occasionally a number may be invalid and an error is thrown from Twilio. I know I can comment out the echo in the catch but if an exception is still thrown I need to my loop to continue. Should I remove the try catch entirely?
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();
}
}