Skip to content

Instantly share code, notes, and snippets.

@rahims
Created July 28, 2011 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahims/1112583 to your computer and use it in GitHub Desktop.
Save rahims/1112583 to your computer and use it in GitHub Desktop.
Sample code that shows how to get all the notifications for your Twilio account
<?php
require 'Services/Twilio.php';
$ACCOUNT_SID = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$AUTH_TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN);
try {
$notifications = $client->account->notifications->getIterator();
echo '<ul>';
foreach ($notifications as $notification)
{
echo '<li>';
echo '<a href="'.$notification->more_info.'">'.$notification->error_code.'</a> / <a href="https://www.twilio.com/user/account/log/view-error?sid='.$notification->sid.'">'.$notification->sid.'</a>';
echo '<p>'.$notification->message_text.'</p>';
echo '</li>';
}
echo '</ul>';
}
catch (Exception $e) {
echo 'Error: '.$e->getMessage();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment