在PHP

2014-02-07 108 views
0

這抓取關鍵細節是twilio api代碼。這裏'callsid'是一個查詢字符串。在PHP

$url = 'http://xxxx.com/phone/customer?to='.$number; 
$call= $this->twilio->account->calls->get($this->request->query->get('CallSid')); 
$call->update(array(
    'Url' => $url, 
    'Method' => 'GET', 
    'StatusCallbackMethod' => 'GET', 
    'StatusCallback' => 'http://xxxx.com/phone/log/callback' 
)); 

我的問題是,我們可以在查詢字符串的地方放置一個數組鍵來獲取關鍵細節?像這樣:

$url = 'http://xxxx.com/phone/customer?to='.$number; 
$call = $this->twilio->account->calls->get($this->request->query->get('url')); 
$call->update(array(
    'Url' => $url, 
    'Method' => 'GET', 
    'StatusCallbackMethod' => 'GET', 
    'StatusCallback' => 'http://xxxx.com/phone/log/callback' 
)); 
+1

當您嘗試使用替代方法時會發生什麼? –

+0

HHAVNT TRIED?.. – william

+1

您應該。你可以回答你自己的問題。 –

回答

0

Ricky從Twilio在這裏。

如果您想通過我們的PHP庫,你可以使用一個迭代器比CallSid其他東西進行過濾。例如該代碼將返回當前正在進行的呼叫:

$filteredCalls = $client->account->calls->getIterator(
    0, 50, array("Status" => "in-progress")); 
foreach($filteredCalls as $call) { 
    print $call->price . '\n'; 
    print $call->duration . '\n'; 
} 

您可以查看list of available filters in the docs