【问题标题】:Forwarding SMS messages to multiple phone #'s on Twilio在 Twilio 上将 SMS 消息转发到多个电话号码
【发布时间】:2016-05-04 18:47:22
【问题描述】:

我目前将 SMS 转发到一个号码用于多个应用程序 - 它使我的 SMS 收件箱保持整洁 - 喜欢它。

但是,我们正在使用多个 SMS 警报服务,我想将它们转发给我的团队,以便我们都能收到警报。我的编码技能不是很强,所以我在这里努力了解我可以做些什么来完成这项工作。长话短说,一条 SMS 消息进来并立即转发到多个号码。

这是我用于转发到一个号码的代码。如何转发到多个号码?

> [root@centos64 html]# more fwdsms.php 
> <?php 
> header('Content-Type: text/html'); 
> ?> 
> <Response>   
>    <Message to="<?=$_REQUEST['PhoneNumber']?>">
> <?=htmlspecialchars(substr($_REQUEST['From'] . ": " . $_REQUEST['Body'], 0, 1600))?>   
> </Message> 
> </Response> 
> [root@centos64 html]#

【问题讨论】:

    标签: twilio


    【解决方案1】:

    如果您要转发的号码列表不是很大,在这种情况下,最简单的方法可能是在您的脚本中添加多个 &lt;Message&gt; verbs

    <Message to="RECIPIENT1">
    <?=htmlspecialchars(substr($_REQUEST['From'] . ": " . $_REQUEST['Body'], 0, 1600))?>   
    </Message>
    <Message to="RECIPIENT2">
    <?=htmlspecialchars(substr($_REQUEST['From'] . ": " . $_REQUEST['Body'], 0, 1600))?>   
    </Message>
    

    要稍微清理一下,您可以将 $_REQUEST 信息存储在 $message 变量中,然后执行以下操作:

    <Message to="RECIPIENT1"> <?php echo $message; ?></Message>
    <Message to="RECIPIENT2"> <?php echo $message; ?></Message>
    

    如果这有帮助,请告诉我!

    【讨论】:

    • 太棒了!很高兴您已经启动并运行。
    猜你喜欢
    • 1970-01-01
    • 2015-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-15
    • 1970-01-01
    • 1970-01-01
    • 2011-10-13
    相关资源
    最近更新 更多