当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::addRedirect方法代码示例

本文整理汇总了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);
 }
开发者ID:HighTechTorres,项目名称:TwilioCookbook,代码行数:7,代码来源:Tester.class.php

示例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();
开发者ID:johndbritton,项目名称:DopplrVBX,代码行数:10,代码来源:twiml.php

示例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();
}
开发者ID:e6,项目名称:OpenVBX-Plugin-Scheduling,代码行数:31,代码来源:twiml.php

示例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();
开发者ID:joshgomez,项目名称:OpenVBX,代码行数:20,代码来源:twiml.php

示例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);
开发者ID:JeffaCubed,项目名称:OpenVBX,代码行数:31,代码来源:twiml.php

示例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
开发者ID:pontocertosms,项目名称:php_examples,代码行数:31,代码来源:call_transfer.php

示例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();
开发者ID:andrewwatson,项目名称:FourSquare-VBX-Plugin,代码行数:30,代码来源:twiml.php

示例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();
开发者ID:muthukumaroptisol,项目名称:plivohelper-php,代码行数:14,代码来源:redirect.php

示例9: Response

<?php

$response = new Response();
$url = AppletInstance::getBaseURI();
$response->addRedirect($url . '/start');
$response->Respond();
开发者ID:kressaty,项目名称:OpenVBX-Plugin-Restart,代码行数:6,代码来源:twiml.php

示例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();
}
开发者ID:kressaty,项目名称:OpenVBX-Plugin-Curling,代码行数:21,代码来源:twiml.php

示例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();
开发者ID:davidangelcb,项目名称:voice,代码行数:10,代码来源:get-input.php

示例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();
}
开发者ID:jmhobbs,项目名称:Twillip,代码行数:21,代码来源:example.php

示例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;
        }
    }
}
开发者ID:HighTechTorres,项目名称:TwilioCookbook,代码行数:31,代码来源:twiml.php

示例14: testRedirectConvience

 public function testRedirectConvience()
 {
     $r = new Response();
     $r->addRedirect();
     $expected = '<Response><Redirect></Redirect></Response>';
     $this->assertXmlStringEqualsXmlString($expected, $r->asUrl(False));
 }
开发者ID:hellobhanu,项目名称:TxtConnect,代码行数:7,代码来源:test_twiml.php

示例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();
开发者ID:joshgomez,项目名称:OpenVBX,代码行数:10,代码来源:twiml.php


注:本文中的Response::addRedirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。