-1

Im trying to get a list of phone numbers under my Twilio account. Im using their example below, I took out the sid and token for security reasons.

include('/lib/Vendor/autoload.php');

use Twilio\Rest\Client;

$sid = "";
$token = "";
$client = new Client($sid,$token);

foreach ($client->incomingPhoneNumbers->read() as $number) {
    echo $number->phoneNumber;
}

However I get this error:

Fatal error: Uncaught exception 'Twilio\Exceptions\DeserializeException' with message 'Page Records can not be deserialized' in E:\websites\twiliosite\lib\Vendor\twilio\sdk\Twilio\Page.php:90

Any idea what Im doing wrong? I googled this and couldnt find anything.

John
  • 9,840
  • 26
  • 91
  • 137
  • This is weird. I didnt do anything, just went back to the page and refreshed and now it works. – John Jun 12 '17 at 18:32

1 Answers1

0

Twilio developer evangelist here.

Looks like that is thrown here: https://github.com/twilio/twilio-php/blob/master/Twilio/Page.php#L90

I've only taken a glance at the code, but it looks to me like if a response body doesn't contain the page of data that was expected and isn't empty then it throws that error.

This could perhaps happen if the connection was interrupted and the page of data was delivered incomplete. That might explain why it worked for you on the second attempt.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Thanks for the info. Yeah it continues to work. Weird, I tried at least 10 times before it started working. Never changed code, never restarted anything. Just weird. But wont complain, it works and again thanks for the info! – John Jun 13 '17 at 23:09