<?php

/**
 * Send message and check for delivery status until it is delivered.
 *
 * Use ../examples.php to test this file
 */
require_once '../oneapi/client.php';
# example:initialize-sms-client
$socinv = new SocialInviteClient(USERNAME, PASSWORD);
$smsClient = new SMSClient(USERNAME, PASSWORD);
# ----------------------------------------------------------------------------------------------------
# example:login-sms-client
$smsClient->login();
# ----------------------------------------------------------------------------------------------------
$siReq = new SocialInviteRequest();
$siReq->senderAddress = SENDER_ADDRESS;
$siReq->recipients = DESTINATION_ADDRESS;
$siReq->messageKey = SOCIAL_INVITES_MESSAGE_KEY;
# ----------------------------------------------------------------------------------------------------
# example:send-invite
$siResult = $socinv->sendInvite($siReq, API_KEY);
# ----------------------------------------------------------------------------------------------------
// The bulk id is a unique identifier of this api call:
$bulkId = $siResult->sendSmsResponse->bulkId;
# ----------------------------------------------------------------------------------------------------
$deliveryStatus = null;
if ($siResult != null) {
    for ($i = 0; $i < 4; $i++) {
        # example:query-for-delivery-status
        // You can use $bulkId as an method call argument here: