I'm working on a project where we need to have a history of incoming text messages dumped to a webpage. I have begun using the Twilio REST API and php library to grab the SMS log data. I'm currently hitting an issue where I'm not able to grab the date sent, however. According to Twilio, I should be able to echo the DateSent
property. Currently only body
and from
are currently working for me.
My 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;
}
Any idea on getting the information I'm seeking to display?
Using js to load this into my webpage and dynamically refresh.
Thank you!