本文整理汇总了PHP中Response::addRedirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::addRedirect方法的具体用法?PHP Response::addRedirect怎么用?PHP Response::addRedirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response::addRedirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callFlow
public function callFlow($flow)
{
$twiml = new Response();
$twiml->addPause();
$twiml->addRedirect(site_url('twiml/applet/voice/' . $flow . '/start'));
$this->startClientCall($twiml);
}
示例2: dirname
<?php
require_once dirname(__FILE__) . '/../../lib/dopplr.php';
$user = OpenVBX::getCurrentUser();
$dopplr_token = PluginData::get("dopplr_token_{$user->id}", "");
$dopplr = new Dopplr($dopplr_token);
$response = new Response();
$response->addSay($dopplr->timezone());
$response->addRedirect(AppletInstance::getDropZoneUrl('next'));
$response->Respond();
示例3: timezones
$ci_timezone = "UM8";
}
$ci->config->set_item('time_reference', 'local');
$ci->load->helper('date');
$offset = (int) timezones($ci_timezone);
$hour = date("G") + $offset;
$server_time = mktime($hour, date("i"), date("s"));
$server_time_formatted = date("G:i", $server_time);
$server_day = date("w", $server_time);
$currentTime = $server_time_formatted;
$finish_time = $finish[$k];
//debug - set a time here to restate $currentTime
//$currentTime = "17:00";
//echo $currentTime.' - '.$b.' - '.$finish_time;
if (verify_time($currentTime, $b, $finish_time) == 1 and verify_day($k, $server_day)) {
$response->addRedirect($choice_array[$k]);
$response->Respond();
$oops = false;
$do_fallback = false;
//echo "passed check ";
break;
} elseif (verify_time($currentTime, $b, $finish_time) == 0 or !verify_day($k, $server_day)) {
$do_fallback = true;
$oops = true;
//echo "failed check ";
}
}
if ($oops == true and $do_fallback == true) {
$response->addRedirect($fallback);
$response->Respond();
}
示例4: Response
<?php
$response = new Response();
$ini = "{$this->plugin_path}/timing.ini";
if (is_readable($ini)) {
$options = parse_ini_file($ini);
try {
$tz = new DateTimeZone($options['timezone']);
} catch (Exception $e) {
error_log($e->getMessage());
}
}
if (empty($tz)) {
$tz = new DateTimeZone('America/Los_angeles');
}
$now = date_create('now', $tz);
// TODO: get from config
$today = date_format($now, 'w') - 1;
$response->addRedirect(AppletInstance::getDropZoneUrl(($from = AppletInstance::getValue("range_{$today}_from")) && ($to = AppletInstance::getValue("range_{$today}_to")) && date_create($from, $tz) <= $now && $now < date_create($to, $tz) ? 'open' : 'closed'));
$response->Respond();
示例5: strlen
$keys = (array) AppletInstance::getDropZoneValue('keys[]');
$menu_items = AppletInstance::assocKeyValueCombine($keys, $choices);
$numDigits = 1;
foreach ($keys as $key) {
if (strlen($key) > $numDigits) {
$numDigits = strlen($key);
}
}
if ($digits !== false) {
if (!empty($menu_items[$digits])) {
$selected_item = $menu_items[$digits];
} else {
if ($invalid_option) {
$verb = AudioSpeechPickerWidget::getVerbForValue($invalid_option, null);
$response->append($verb);
$response->addRedirect();
} else {
$response->addSay('You selected an incorrect option.');
$response->addRedirect();
}
$response->Respond();
exit;
}
}
if (!empty($selected_item)) {
$response->addRedirect($selected_item);
$response->Respond();
exit;
}
$gather = $response->addGather(compact('numDigits'));
$verb = AudioSpeechPickerWidget::getVerbForValue($prompt, null);
示例6: Response
<?php
require_once "./plivo.php";
$r = new Response();
//Add Speak tag
$body = "Please wait while your call is being transferred";
$r->addSpeak($body);
// Add Redirect tag
$redirect = "https://example.com/connect.php";
$r->addRedirect($redirect);
Header('Content-type: text/xml');
echo $r->toXML();
?>
<!--connect.php-->
<?php
require_once "./plivo.php";
$r = new Response();
// Add Speak tag
$body = "Connecting your call..";
$attributes = array('action' => "https://example.com/dial_status.php", 'method' => "GET", 'redirect' => "true");
$r->addSpeak($body);
// Add Dial tag
$d = $r->addDial($attributes);
$number = "11111111111";
$d->addNumber($number);
Header('Content-type: text/xml');
echo $r->toXML();
/*
Sample Output
示例7: Response
<?php
include "foursquare_api.php";
$user = AppletInstance::getUserGroupPickerValue('4sq-cat-controller');
$user_id = $user->values["id"];
$foursquare_username = PluginStore::get("foursquare_username_{$user_id}", "");
$foursquare_password = PluginStore::get("foursquare_password_{$user_id}", "");
$default = AppletInstance::getDropZoneUrl('4sq-cat-default-action');
$response = new Response();
if (!empty($foursquare_username)) {
$lastVenue = getLastVenue($foursquare_username, $foursquare_password);
$category = getCategory($lastVenue);
$categories = AppletInstance::getValue('categories[]');
$category_options = AppletInstance::getDropZoneUrl('category_options[]');
$found = false;
if (is_array($categories)) {
foreach ($categories as $id => $value) {
if ($value == $category) {
$response->addRedirect($category_options[$id]);
$found = true;
}
}
}
if (!$found) {
$response->addRedirect($default);
}
} else {
$response->addRedirect($default);
}
$response->Respond();
示例8: dirname
<?php
// Include the PHP Plivo Rest library
require "./plivohelper.php";
$base_http = "http://" . dirname($_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"]);
/* Render RESTXML */
$r = new Response();
if ($_GET['redirect'] == 'true' || $_POST['redirect'] == 'true') {
$r->addSpeak("Redirect done !");
$r->addHangup();
} else {
$r->addRedirect($base_http . "/answered.php?redirect=true");
}
$r->Respond();
示例9: Response
<?php
$response = new Response();
$url = AppletInstance::getBaseURI();
$response->addRedirect($url . '/start');
$response->Respond();
示例10: Response
<?php
$response = new Response();
$url = AppletInstance::getValue('url');
$next = AppletInstance::getDropZoneUrl('next');
$fallback = AppletInstance::getDropZoneUrl('fallback');
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl_handle);
curl_close($curl_handle);
if (empty($result)) {
$response->addSay('that didnt work');
$response->addRedirect($fallback);
$response->Respond();
} else {
$response->addSay($result);
$response->addRedirect($next);
$response->Respond();
}
示例11: Response
<?php
require_once 'plivo.php';
$response = new Response();
$response->addSpeak('Record your message at the tone, after you are done, press pound');
$response->addRecord(array('action' => 'http://' . $_SERVER["SERVER_NAME"] . '/plivo-voicemail/confirm-input.php', 'method' => 'GET', 'maxLength' => '60', 'finishOnKey' => '#', 'playBeep' => 'true'));
$response->addSpeak('Recording not received');
$response->addRedirect('http://' . $_SERVER["SERVER_NAME"] . '/plivo-voicemail/get-input.php', array('method' => 'GET'));
header('content-type: text/xml');
echo $response->toXML();
示例12: Response
<?php
define('IS_DEV', true);
require_once 'twilio.php';
if (IS_DEV) {
require_once 'twillip.php';
Twillip::Start();
}
$r = new Response();
if (isset($_REQUEST['Caller'])) {
$r->addSay('This app uses Twillip for obviously awesome reasons!');
$r->addPlay('funky-beats.mp3', array('loop' => 3));
$r->addRedirect('/doesntexist.php');
} else {
$r->addSay('Oh no! I didn\'t get sent a phone number! Who in blue blazes are you?');
$r->addSay('This line will generate a PHP warning now: ' . $_REQUEST['Caller']);
}
$r->respond();
if (IS_DEV) {
Twillip::End();
}
示例13: Response
<?php
$response = new Response();
$keys = AppletInstance::getValue('keys');
$invalid = AppletInstance::getDropZoneUrl('invalid');
$selected_item = false;
$choices = AppletInstance::getDropZoneUrl('choices[]');
$keys = AppletInstance::getDropZoneValue('keys[]');
$router_items = AppletInstance::assocKeyValueCombine($keys, $choices);
if (isset($_REQUEST['From']) && array_key_exists($_REQUEST['From'], $router_items)) {
$routed_path = $router_items[$_REQUEST['From']];
$response->addRedirect($routed_path);
$response->Respond();
exit;
} else {
if (isset($_REQUEST['Caller']) && array_key_exists($_REQUEST['Caller'], $router_items)) {
$routed_path = $router_items[$_REQUEST['Caller']];
$response->addRedirect($routed_path);
$response->Respond();
exit;
} else {
if (!empty($invalid)) {
$response->addRedirect($invalid);
$response->Respond();
exit;
} else {
$response->Respond();
exit;
}
}
}
示例14: testRedirectConvience
public function testRedirectConvience()
{
$r = new Response();
$r->addRedirect();
$expected = '<Response><Redirect></Redirect></Response>';
$this->assertXmlStringEqualsXmlString($expected, $r->asUrl(False));
}
示例15: Response
<?php
$response = new Response();
$next = AppletInstance::getDropZoneUrl('next');
$prompt = AppletInstance::getAudioSpeechPickerValue('prompt');
$response->append(AudioSpeechPickerWidget::getVerbForValue($prompt, null));
if (!empty($next)) {
$response->addRedirect($next);
}
$response->Respond();