I want to send an sms to a list of numbers. One of those numbers may have unsubscribed. However at the moment Twilio throws a very ugly error message if it encounters an unsubscribed number and then just stops.
How do I make it continue going through the array of numbers to text?
Here’s my code so far:
foreach($phoneNumbers as $phoneNumber) {
try{
$client->messages->create(
$phoneNumber,
array(
'from' => $twilio_number,
'body' => 'Testing from my website'
)
);
} catch (DeserializeException $e) { }
catch (TwilioException $e) { }
}