【发布时间】:2016-03-14 21:08:46
【问题描述】:
我正在开展一个项目,我们需要将传入的短信历史转储到网页。我已经开始使用 Twilio REST API 和 php 库来获取 SMS 日志数据。但是,我目前遇到了一个无法获取发送日期的问题。根据 Twilio 的说法,我应该能够回显 DateSent 属性。目前只有body 和from 正在为我工作。
我的 php:
<?php
// this line loads the library
require('xxxx/twilio-php/Services/Twilio.php');
$account_sid = 'xxxxxxxxxxxxxxxxxxxxxxxxxx';
$auth_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxx';
$client = new Services_Twilio($account_sid, $auth_token);
$messages = $client->account->messages->getIterator(0, 50, array(
));
foreach ($messages as $message) {
echo $message->body;
echo $message->DateSent;
echo $message->from;
}
对获取我想要显示的信息有任何想法吗?
使用 js 将其加载到我的网页中并动态刷新。
谢谢!
【问题讨论】:
标签: php twilio twilio-php