function DeliverXms($complex) { global $soap; $soap = TRUE; $xmsData = $complex->xmsData; $xmsData = str_replace("UTF-16", "UTF-8", $xmsData); $return = '<?xml version="1.0" encoding="utf-16"?>' . "\n"; try { $xml = new SimpleXMLElement($xmsData); $user = (string) $xml->user->userId; $pass = (string) $xml->user->password; try { $gv = new GoogleVoice($user, $pass); $recps = $xml->xmsHead->to->recipient; $msgs = $xml->xmsBody->content; foreach ($recps as $to) { if (substr($to, 0, 1) == 1) { $to = substr($to, 1); } foreach ($msgs as $msg) { $gv->sms($to, $msg); } } $return .= '<xmsResponse xmlns="http://schemas.microsoft.com/office/Outlook/2006/OMS"><error code="ok" severity="neutral" /></xmsResponse>'; } catch (Exception $e) { $return .= '<userInfo xmlns="http://schemas.microsoft.com/office/Outlook/2006/OMS"><error code="invalidUser" severity="failure" /></userInfo>'; } } catch (Exception $e) { $return .= '<userInfo xmlns="http://schemas.microsoft.com/office/Outlook/2006/OMS"><error code="invalidFormat" severity="failure" /></userInfo>'; } return array("DeliverXmsResult" => $return); }
function gv_send($gmail, $gmail_pwd, $msg) { try { $gv = new GoogleVoice($gmail, $gmail_pwd); $arr = splitText($msg, ' ', 140); $i = count($arr) - 1; while ($i >= 0) { $gv->sms($a[1], $arr[$i]); $i--; } // echo sent successfully //$global['xajax_res']->addAppend('rezLog', 'innerHTML', '<br>New SMS message was sent to '. $a[0]. ', status: '.$gv->status); } catch (Exception $e) { // echo save error //em_save_post_error($id, $_SESSION['user'], $e->getMessage()); // echo error //$global['xajax_res']->addAppend('rezLog', 'innerHTML', '<br>SMS error:'. $e->getMessage()); } }
public static function SendItOut(Reminder $reminder) { $message = $reminder->Message(); $subject = "Automatic Reminder from Booked Scheduler"; /* replace 'username' and 'password' with your GoogleVoice sign-in */ $gv = new GoogleVoice("username", "password"); $addresses = explode(',', str_replace(' ', '', $reminder->Address())); foreach ($addresses as $address) { var_dump($address); if (ctype_digit($address)) { $gv->sms($address, $message); } else { mail($address, $subject, $message); } } $repository = new ReminderRepository(); $repository->DeleteReminder($reminder->ReminderID()); return; }