doubianyu7844 2019-04-22 15:01 采纳率: 0%
浏览 84

如何在php xml文件中记录Twilio sms响应的详细信息

I have implemented Twilio SMS response from Youtube video (its just one minute video) This works for all the cases but if I receive a text from Google Pixel I am not able to respond I am storing all the SMS response into the database but I am not able to store the ones coming from Google Pixel.

    <?php
header('Content-Type: text/xml');
include "config.php";
require __DIR__ . '/Twilio/autoload.php';// Loads the library

// prepare and bind
$stmt = $con->prepare("INSERT INTO sms (MessageSid, smsFrom, smsTo, Body, timeStamp) VALUES (?, ?, ?, ?, ?)");
$stmt->bind_param("sssss", $MessageSid, $FromNumber, $ToNumber, $body, $timeStamp);


$FromNumber = isset($_POST['From']) ? $_POST['From'] : '0';
$body = isset($_POST['Body']) ? $_POST['Body'] : '0';
$MessageSid = isset($_POST['MessageSid']) ? $_POST['MessageSid'] : '0';
$ToNumber = isset($_POST['To']) ? $_POST['To'] : '0';
$timeStamp = date("Y-m-d H:i:s");

$stmt->execute();

$stmt->close();
$con->close();
?>

What twilio does is they will allow us a web-hook and we can get the response. I can see SMS in their logs and my web-hook is executed successfully but there is nothing stored in our DB. any ideas on how to debug it? I tried sending emails with all the values but it throws me an error as this is an xml file.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大