Twilio REST API How to get Sid -
i still new twilio. writing php script connect twilio , parse information calls. using code page:
https://www.twilio.com/docs/api/rest/call
here code:
require_once '../twilio-library/services/twilio.php'; // twilio rest api version $version = '2010-04-01'; // set our accountsid , authtoken $sid = 'abc132xxxxx'; $token = 'xxxxeeffv'; // instantiate new twilio rest client $client = new services_twilio($sid, $token, $version); // loop on list of calls , echo property each 1 foreach ($client->account->calls $call) { echo "->".$call->sid."<- <br/>"; }
the browser outputs many blanks. no sid values. doing wrong?
twilio developer evangelist here.
try doing following call information.
<?php require_once '../twilio-library/services/twilio.php'; // account sid , auth token twilio.com/user/account $sid = 'abc132xxxxx'; $token = 'xxxxeeffv'; $client = new services_twilio($sid, $token); // loop on list of calls , echo property each 1 foreach ($client->account->calls $call) { echo $call->sid; }
notice if you're using latest version of library, don't need specify version on request. double check path ../twilio-library/services/twilio.php
correct though.
if you're testing, move file twilio.php
same directory code , import twilio.php
on it.
if decide filter logs date, here's how it.
// loop on list of calls , echo property each 1 foreach ($client->account->calls->getiterator(0, 50, array( "status" => "completed", "starttime>" => "2015-03-01", "starttime<" => "2015-05-10" )) $call ) { echo $call->sid; }
let me know how goes.
Comments
Post a Comment