/*
// if you don't want to use the credetials import, just use the below variables 
// Set up account details
$username = '******';
$password = '******';

// http://www.acma.gov.au/Citizen/Consumer-info/All-about-numbers/Special-numbers/fictitious-numbers-for-radio-film-and-television-i-acma
$recipient = "+61491570156";
*/
require 'getStdin.php';
// Create new MMSoap class
$soap = new MMSoap($username, $password, $options);
echo "** Do you want to send a message to {$recipient}, y followed by ENTER to send, or ENTER to skip.\n";
if (getStdin("y")) {
    // send the message
    $response = $soap->sendMessage($recipient, "messagemedia-php: please reply & press Enter on example when done.");
    if ($response instanceof SoapFault) {
        exit('Error: ' . $response->getMessage());
    }
    $result = $response->getResult();
    echo $result->sent . ' sent / ' . $result->scheduled . ' scheduled / ' . $result->failed . " failed\n\n";
    // message has been sent, give the user time to reply
    echo "Please reply to the message you just received and hit ENTER.\n";
    getStdin("");
}
echo "** Check for replies\n";
$response = $soap->getReplies();
if ($response instanceof SoapFault) {
    exit('Error: ' . $response->getMessage());
}
$result = $response->getResult();
*/
// Set up sendMessage parameters
// http://www.acma.gov.au/Citizen/Consumer-info/All-about-numbers/Special-numbers/fictitious-numbers-for-radio-film-and-television-i-acma
$recipients = array($recipient);
// MessageId array matches each recipient. i.e. 61491570156 will match 24.
$messageIds = array('24');
$origin = "+61491570157";
// for scheduled messages lets schedule a message 1 minte in the future
$oneMinuteInTheFuture = mktime(date("H"), date("i") + 1, date("s"), date("m"), date("d"), date("Y"));
// Create new MMSoap class
$soap = new MMSoap($username, $password, $options);
// Send a simple message
$recipient = $recipients[0];
echo "\n** Send Messages\n";
echo "Sending message to {$recipient}\n";
$response = $soap->sendMessage($recipient, "messagemedia-php: simple message");
if ($response instanceof SoapFault) {
    exit('Error: ' . $response->getMessage());
}
$result = $response->getResult();
echo $result->sent . ' sent / ' . $result->scheduled . ' scheduled / ' . $result->failed . " failed\n";
// Example sending a more complex request
// - scheduled
// - source number
// - delivery report
// - sequence number
// - message ids
echo "\nScheduling to send message on " . date('l jS \\of F Y h:iA', $oneMinuteInTheFuture) . " to " . implode(', ', $recipients) . "\n";
$scheduled = date('Y-m-d\\TG:i:s', $oneMinuteInTheFuture);
$sequenceNumber = 10;
$response = $soap->sendMessages($recipients, "messagemedia-php: scheduled message", $scheduled, $origin, TRUE, $sequenceNumber, $messageIds);