本文整理匯總了PHP中OpenVBX::validateRequest方法的典型用法代碼示例。如果您正苦於以下問題:PHP OpenVBX::validateRequest方法的具體用法?PHP OpenVBX::validateRequest怎麽用?PHP OpenVBX::validateRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OpenVBX
的用法示例。
在下文中一共展示了OpenVBX::validateRequest方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validate_rest_request
/**
* Validate that an incoming rest request is from Twilio
*
* @param string $failure_message
* @return void
*/
function validate_rest_request($failure_message = 'Could not validate this request. Goodbye.')
{
$ci =& get_instance();
if ($ci->tenant->type == VBX_Settings::AUTH_TYPE_CONNECT) {
return;
}
if (!OpenVBX::validateRequest()) {
$response = new TwimlResponse();
$response->say($failure_message, array('voice' => $ci->vbx_settings->get('voice', $ci->tenant->id), 'language' => $ci->vbx_settings->get('voice_language', $ci->tenant->id)));
$response->hangup();
$response->respond();
exit;
}
}
示例2: deauthorize
/**
* Twilio calls us when a user deauthorizes our connect account
*
* @return void
*/
public function deauthorize()
{
$header = '405';
// method not allowed
if (OpenVBX::validateRequest() || 1 == 1) {
if ($account_sid = $this->input->post('AccountSid')) {
$result = $this->db->select('tenants.*')->from('tenants')->join('settings', 'tenants.id = settings.tenant_id')->where('settings.name = "twilio_sid"')->where('settings.value = "' . $this->db->escape_str($account_sid) . '"')->limit(1)->get()->result();
if (!empty($result)) {
$tenant = current($result);
if ($tenant->id) {
log_message('info', 'AccountSid "' . $account_sid . '" deauthorized on ' . date('r') . ' (server tz: ' . date_default_timezone_get() . ')');
$this->setup_connect_tenant('deauthorized_client', $tenant->id);
$header = '204';
// accepted, but no content to return
}
}
$header = '400';
// sid not found so its a bad request
}
}
set_status_header($header);
exit;
}