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()); } }
<?php include '../GoogleVoice.php'; include 'LoginInfo.php'; $gv = new GoogleVoice($username, $password); echo '<pre>'; echo 'Phone Number: ', $gv->getNumber(), "\n\n"; // call a phone from one of your forwarding phones $gv->callNumber('9999999999', '8888888888', 'mobile'); // send an SMS to a phone number $gv->sendSMS('9999999999', 'Sending a message!'); // fetch new voicemails $voicemails = $gv->getNewVoicemail(); $msgIDs = array(); foreach ($voicemails as $s) { preg_match('/\\+1([0-9]{3})([0-9]{3})([0-9]{4})/', $s['phoneNumber'], $match); $phoneNumber = '(' . $match[1] . ') ' . $match[2] . '-' . $match[3]; echo 'Message from: ' . $phoneNumber . ' on ' . $s['date'] . "\n" . $s['message'] . "\n\n"; if (!in_array($s['msgID'], $msgIDs)) { // mark the conversation as "read" in google voice $gv->markSMSRead($s['msgID']); $msgIDs[] = $s['msgID']; } } // get all new SMSs $sms = $gv->getNewSMS(); $msgIDs = array(); foreach ($sms as $s) { preg_match('/\\+1([0-9]{3})([0-9]{3})([0-9]{4})/', $s['phoneNumber'], $match); $phoneNumber = '(' . $match[1] . ') ' . $match[2] . '-' . $match[3]; echo 'Message from: ' . $phoneNumber . ' on ' . $s['date'] . ': ' . $s['message'] . "\n";
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; }
<?php include 'GoogleVoice.php'; $gv = new GoogleVoice('your.name', 'password'); // call a phone from one of your forwarding phones $gv->callNumber('9995551212', '5558675309', 'mobile'); // send an SMS to a phone number $gv->sendSMS('9995551212', 'Sending a message!'); // fetch new voicemails $voicemails = $gv->getNewVoicemail(); $msgIDs = array(); foreach ($voicemails as $s) { preg_match('/\\+1([0-9]{3})([0-9]{3})([0-9]{4})/', $s['phoneNumber'], $match); $phoneNumber = '(' . $match[1] . ') ' . $match[2] . '-' . $match[3]; echo 'Message from: ' . $phoneNumber . ' on ' . $s['date'] . "\n" . $s['message'] . "\n\n"; if (!in_array($s['msgID'], $msgIDs)) { // mark the conversation as "read" in google voice $gv->markSMSRead($s['msgID']); $msgIDs[] = $s['msgID']; } } // get all new SMSs $sms = $gv->getNewSMS(); $msgIDs = array(); foreach ($sms as $s) { preg_match('/\\+1([0-9]{3})([0-9]{3})([0-9]{4})/', $s['phoneNumber'], $match); $phoneNumber = '(' . $match[1] . ') ' . $match[2] . '-' . $match[3]; echo 'Message from: ' . $phoneNumber . ' on ' . $s['date'] . ': ' . $s['message'] . "\n"; if (!in_array($s['msgID'], $msgIDs)) { // mark the conversation as "read" in google voice $gv->markSMSRead($s['msgID']);
function processSequenceName($sequenceName, $sequenceAction = "NONE RECEIVED") { global $CONTROL_NUMBER_ARRAY, $PLAYLIST_NAME, $EMAIL, $PASSWORD, $pluginDirectory, $pluginName; logEntry("Sequence name: " . $sequenceName); $sequenceName = strtoupper($sequenceName); //$PLAYLIST_NAME= getRunningPlaylist(); if ($PLAYLIST_NAME == null) { $PLAYLIST_NAME = "FPPD Did not return a playlist name in time, please try again later"; } // switch ($sequenceName) { // case "SMS-STATUS-SEND.FSEQ": $messageToSend = ""; $gv = new GoogleVoice($EMAIL, $PASSWORD); //send a message to all numbers in control array and then delete them from new messages for ($i = 0; $i <= count($CONTROL_NUMBER_ARRAY) - 1; $i++) { logEntry("Sending message to : " . $CONTROL_NUMBER_ARRAY[$i] . " that playlist: " . $PLAYLIST_NAME . " is ACTION:" . $sequenceAction); //get the current running playlist name! :) //$gv->sendSMS($CONTROL_NUMBER_ARRAY[$i], "PLAYLIST EVENT: ".$PLAYLIST_NAME." Action: ".$sequenceAction); $gv->sendSMS($CONTROL_NUMBER_ARRAY[$i], "PLAYLIST EVENT: Action: " . $sequenceAction); } logEntry("Plugin Directory: " . $pluginDirectory); //run the sms processor outside of cron $cmd = $pluginDirectory . "/" . $pluginName . "/getSMS.php"; exec($cmd, $output); // break; // exit(0); // default: // logEntry("We do not support sequence name: ".$sequenceName." at this time"); // exit(0); // } }
<?php include 'GoogleVoice.php'; // NOTE: Full email address required. $gv = new GoogleVoice('*****@*****.**', 'password'); // Call a phone from one of your forwarding phones. $gv->callNumber('9995551212', '5558675309', 'mobile'); // Cancel in-progress call placed using callNumber. $gv->cancelCall('9995551212', '5558675309', 'mobile'); // Send an SMS to a phone number. $gv->sendSMS('9995551212', 'Sending a message!'); // Get all unread SMSs from your Google Voice Inbox. $sms = $gv->getUnreadSMS(); $msgIDs = array(); foreach ($sms as $s) { echo 'Message from: ' . $s->phoneNumber . ' on ' . $s->displayStartDateTime . ': ' . $s->messageText . "<br><br>\n"; if (!in_array($s->id, $msgIDs)) { // Mark the message as read in your Google Voice Inbox. $gv->markMessageRead($s->id); $msgIDs[] = $s->id; } } // Get all unread messages from your Google Voice Voicemail. $voice_mails = $gv->getUnreadVoicemail(); $msgIDs = array(); foreach ($voice_mails as $v) { echo 'Message from: ' . $v->phoneNumber . ' on ' . $v->displayStartDateTime . ': ' . $v->messageText . "<br><br>\n"; if (!in_array($v->id, $msgIDs)) { // Mark the message as read in your Google Voice Voicemail. $gv->markMessageRead($v->id); $msgIDs[] = $v->id;
include_once '../GoogleVoice.php'; //include_once('../firephp/FirePHP.class.php'); // //$firephp = FirePHP::getInstance(true); // //$firephp->log($username, 'username'); //$firephp->log($password, 'password'); $submitted = $_POST['submitted']; $username = $_POST['username']; $password = $_POST['password']; $numbersRaw = $_POST['numbersRaw']; $message = $_POST['message']; if (!empty($submitted) && $submitted == 'submitted' && !empty($username) && !empty($password) && !empty($numbersRaw) && !empty($message)) { $numbers = explode(',', $numbersRaw); array_walk($numbers, 'trim_value'); $gv = new GoogleVoice($username, $password); $errorMsg = ''; echo 'Sending Messages...<br/><br/>'; try { $numbers = $gv->sendSMS($numbers, $message); } catch (Exception $e) { $errorMsg = $e->getMessage(); } if ($errorMsg != '') { echo "Unable to send messages for the following reason:<br/>"; echo '<ul><li>', htmlentities($errorMsg), '</li></ul>'; } else { echo "Message sent to the following: <br/>"; echo '<ul>'; foreach ($numbers as $number) { echo '<li>', $number, '</li>';
<?php require_once 'GoogleVoice.php'; $GV = new GoogleVoice('username', 'password'); $GV->login(); $messages = $GV->get_messages(true); print_r($messages); print_r($GV->message_count()); $GV->mark_as($messages[0]['id'], true); $GV->mark_as($messages[0]['id'], false); $nums = $GV->get_contact_numbers($messages[0]['contact_id']); print_r($nums); echo $GV->_rnr_se() . PHP_EOL; $phones = $GV->get_phones(); print_r($phones); //$GV->call_number('', ''); //$GV->send_sms('', 'Test'); $grant = $GV->search_contacts('grant'); print_r($grant); $newall = $GV->get_all_new_messages(); print_r($newall);
} //arg0 is the program //arg1 is the first argument in the registration this will be --list //$DEBUG=true; //echo "Enabled: ".$ENABLED."<br/> \n"; if ($ENABLED != "on" && $ENABLED != "1") { logEntry("Plugin Status: DISABLED Please enable in Plugin Setup to use & Restart FPPD Daemon"); lockHelper::unlock(); exit(0); } if ($DEBUG) { echo "user: "******"<br/ \n"; echo "pass: "******"<br/> \n"; } // NOTE: Full email address required. $gv = new GoogleVoice($EMAIL, $PASSWORD); // Send an SMS to a phone number. //$gv->sendSMS('6198840018', 'Sending a message!'); processReadSentMessages(); sleep($GVSleepTime); $messageQueue = processNewMessages(); if ($DEBUG) { print_r($messageQueue); } if ($messageQueue == null) { lockHelper::unlock(); exit(0); } if ($DEBUG) { print_r($messageQueue); }
<?php require "../../includes/GoogleVoice.php"; require "../../includes/functions.php"; if (isset($_GET["phone"])) { if (!isset($_GET["id"])) { $id_num = rand(1, 216); } else { $id_num = $_GET["id"]; } $fact = query("SELECT data from `facts` WHERE id = ?", $id_num)[0]['data']; $account = query("SELECT * from `voice_accts`")[0]; try { $gv = new GoogleVoice($account['email'], $account['password']); $gv->sendSMS($_GET["phone"], $fact); $response = "{'status':'Success','fact':" . $fact . "}"; } catch (Exception $e) { echo $e; } } else { $response = "{'status':'Failed'}"; } //header('Content-type: application/json'); echo json_encode($response);