/** * action for sending international messages * this done just for one account */ public function intrsmsAction() { $msgObj = new Application_Model_Message($this->user); $ID = $this->user->getId(); if ($this->getRequest()->isPost()) { $sid = "ACbf5f17a1be48a06f94eb500d22c0b8f8"; // Your Account SID from www.twilio.com/user/account $token = "d7f61830172db0b42d3c6531e9707238"; //"f@r@d2013"; // Your Auth Token from www.twilio.com/user/account require '/var/www/zendfw/zend/library/Zend/Service/Twilio.php'; $client = new Services_Twilio($sid, $token); // processing folders ids send by ajax $jarr = json_decode($this->request->getParam('data'), true); // processing message body $msg = $this->request->getParam('msg'); // fetching phonenumbers $phones = $msgObj->getphonesForIntrSms(implode(',', $jarr)); $totalPhonenumbers = count($phones); for ($pnr = 0; $pnr < $totalPhonenumbers; $pnr++) { $phn = $phones[$pnr]; $intrpn = '+' . $phn; $message = $client->account->sms_messages->create('+17786530459', $intrpn, $msg); $msgObj->internationalSms($ID, $phn, $message->sid, $msg); } // echo print_r($phones); echo 'SEND SUCCESSFULLY'; } exit; }