因此,我正在尝试接收传入的短信,并根据短信所说的内容拨打特定录音的电话。
例如:
我有一个带有调制解调器的门传感器,可以在门打开或门关闭时向我的 twilio # 发送文本。
如果 Twilio 收到“门打开”文本,则 twilio 将拨打我的手机并播放“门已打开”的录音
如果 Twilio 收到“门已关闭”的文本,则 twilio 将拨打我的手机并播放“门已关闭”的录音
<?php
require_once('/home/protranx/public_html/twilio-php- latest/Services/Twilio.php');
$sid = "SID";
$token = "Token";
$client = new Services_Twilio($sid, $token);
$alert = $_REQUEST['body'];
$TwilioNumber = "+twilio #";
$to = "+my cell #";
$url1 = "http://protran.x10.mx/Oak1_armed_door_open.php";
$url2 = "http://protran.x10.mx/Oak1_disarmed_door_closed.php";
$string1 = "door open";
$string2 = "door closed";
if ($alert == $string1){
$call = $client->account->calls->create($TwilioNumber, $to, $url1);}
elseif ($alert == $string2){
$call = $client->account->calls->create($TwilioNumber, $to, $url2);}
echo $call->sid;
header('content-type: text/xml');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
</Response>
我不断收到此错误:错误:12100 - 文档解析失败
任何帮助将不胜感激。
谢谢