本文整理汇总了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;
}