echo "\t\tPrice: " . $message->pricePerMessage->price . "\n";
    echo "\t\tCurrency: " . $message->pricePerMessage->currency . "\n";
    echo "\tDestination Network: \n";
    echo "\t\tId: " . $message->destinationNetwork->id . "\n";
    echo "\t\tName: " . $message->destinationNetwork->name . "\n";
    echo "\t\tCountry: \n";
    echo "\t\t\tId: " . $message->destinationNetwork->country->id . "\n";
    echo "\t\t\tCode: " . $message->destinationNetwork->country->code . "\n";
    echo "\t\t\tPrefix: " . $message->destinationNetwork->country->prefix . "\n";
    echo "\t\t\tName: " . $message->destinationNetwork->country->name . "\n";
    echo "\t\t\tLocale: " . $message->destinationNetwork->country->locale . "\n";
    echo "**********************************\n";
}
if ($messages->isMoreAvailable()) {
    $oldestMessage = $messages->logs[sizeof($messages->logs) - 1];
    $toTime = OneApiDateTime::createFromFormat('Y-m-dTH:i:s....O', $oldestMessage->sendDateTime);
    //fetching the next "page"
    $messages = $smsClient->retrieveOutboundMessages($fromTime, $toTime);
    foreach ($messages->logs as $message) {
        echo $message->sendDateTime;
        echo $message->messageId;
        echo $message->smsCount;
        echo $message->mcc;
        echo $message->mnc;
        echo $message->countryCode;
        echo $message->destinationAddress;
        echo $message->sender;
        echo $message->pricePerMessage;
        echo $message->clientMetadata;
        echo $message->messageText;
        echo "\n";
Пример #2
0
 /**
  * Get the list of sent SMS messages.
  */
 public function retrieveOutboundMessages($fromTime = null, $toTime = null, $messageId = null)
 {
     $params = array();
     if (!$fromTime) {
         $fromTime = OneApiDateTime::createFromFormat('Y-m-dTH:i:s....O', '1970-01-01T00:00:00.000+0000');
     }
     $params['from'] = $fromTime->format('Y-m-d\\TH:i:s.000O');
     if ($toTime) {
         $params['to'] = $toTime->format('Y-m-d\\TH:i:s.000O');
     }
     $params['messageId'] = $messageId;
     $restUrl = $this->getRestUrl('/2/messaging/outbound/logs/');
     list($isSuccess, $content) = $this->executeGET($restUrl, $params);
     return $this->createFromJSON('infobip\\models\\OutboxMessages', $content, !$isSuccess);
     //return new OutboxMessages($content, $isSuccess);
 }