I am creating an application in PHP and I wanted to integrate Twilio API for sending SMS. I want to handle just the outbound messages. I am using the official Twilio-PHP wrapper library.
require_once "Twilio.php";
$accountSid = "<<test-sid>>";
$authToken= "<<test-auth-token>>";
$fromNumber = "+15005550006";
$client = new Services_Twilio($accountSid, $authToken);
$messages = $client->account->sms_messages->getIterator(0, 50,
array('DateSent>=' => '2013-01-01',
'DateSent<=' => '2013-09-31',
'From' => $fromNumber));
foreach($messages as $message){
echo $message->body;
}
The above code is the core idea of the code that I use in my application. When I run the application, I get the below exception message.
Resource not yet accessible with Test Account credentials
When I use the live account Sid and Auth token with the phone number, it works fine. But I want to test my script with the test credentials. I got the test Sid and auth token from the link https://www.twilio.com/user/account/developer-tools/test-credentials and using the magic number +15005550006 as the "from" phone number. I don't want to be charged during my testing.
Please let me know if I am missing anything in the account setup.
Also I am not sure how to handle this exception and show a user-friendly message.