android - Handle 500 internal server error while sending SMS using twilio in PHP -


I am using Twilio sdk to send SMS in my PHP based application, I have an array of phone numbers And to send an SMS in each loop in the loop ..... The problem is that if there is an invalid number then the loop is running, then the TileLio API returns 500 internal server error and this loop Prevents the remaining number in the array without trying to send SMS.

This is the code I want to send an SMS to:

  public function sendSMSAction {$ userphones} {foreach ($ user $ $ as $ User_phone) {$ message = 'Thank you for coming'; $ This- & gt; Twiliosms ($ user_phone, $ message); }} Private Function twiliosms ($ phone_num, $ message) {Requires Mage :: getBaseDir () "/ Twilio-php-master / services / twilio.php"; $ Accountseed = "XXXXXXX"; $ AUuthToken = "XXXXXXX"; $ Client = new service OtvVyVali ($ accountseed, $ AUTHToken); {$ Message = $ client- & gt; Account-> Message-> Create (Arrays ("from" = "gtc:" + 1XXXXXXXXXX "", "to" => $ phone_num, "body" = & gt; $ message,)); } Hold (Services_Twilio_RestException $ e) {echo $ e-> GetMessage (); }}  

and this is what I am getting the error:

Status: 500 Internal Server Error

'from' number + 1XXXXXXXXXX is not a valid phone number or shortcode code.

Please help me handle this error

Thank you in advance. Finally, I found my solution ... just adding another grip (), this is fine. Working ...

  hold (exception $ E) {}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -