$data = array(
'From' => $from,
'To' => $to,
'Url' => site_url('dashboard/call2')
);
// make call request to Twilio
try{
$twilio = new TwilioRestClient($account_sid, $account_token);
$result = $twilio->request('2010-04-01/Accounts/'. $account_sid .'/Calls',
'POST',
$data
);
pr($result);
}
catch (Exception $e){
pr($e);
}
public function call2() {
$this->load->view('response');
}
这里的响应是视图中的一个 xml 文件。response.xml 必须作为回调 url 调用。但它显示错误:
XML Parsing Error: XML or text declaration not at start of entity
Location: http://www.website.com/index.php/dashboard/call2
Line Number 1, Column 5: <?xml version="1.0" encoding="UTF-8"?>