我有以下代码,程序正在尝试访问它,但我收到500错误。我检查了语法,其他一切都工作正常。
需要注意的一件重要事情是移动的服务器,当我注意到这一点开始发生时,但我不能指出这个问题。
请注意,我已更改了公司名称,电话号码和电子邮件以保护隐私。
<?php
require_once('PHPMailer-
master/class.phpmailer.php');
/**
* This section ensures that Twilio gets a response.
*/
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
$dial_call_status = $_REQUEST['DialCallStatus'];
if($dial_call_status == "completed" || $dial_call_status == "answered"){
$email = new PHPMailer();
$email->From = 'info@somedomain.com';
$email->FromName = 'Business Name';
$email->Subject = "New number calling from
{$_REQUEST['From']}";
$email->Body = "The call comes from the following city {$_REQUEST['FromCity']}, {$_REQUEST['FromState']}. Mp3 attached.";
$email->AddAddress( 'user1@somedomain.com' , 'Mar');
$email->AddAddress( 'user2@somedomain.com' , 'Rol');
$email->AddAddress( 'user3@somedomain.com' , 'Vic');
$recordingUrl = @$_REQUEST['RecordingUrl'];
$duration = @$_REQUEST['Duration'];
$durationRecording = @$_REQUEST['RecordingDuration'];
$callerId = @$_REQUEST['From'].'.mp3';
$attachment_data = file_get_contents($recordingUrl);
$email->addStringAttachment($attachment_data,$callerId, 'base64',
'audio/mpeg3');
if ($durationRecording < 1.0) {
exit;
} else {
return $email->Send();
}
}else{
?>
<Response>
<Sms from="+1555555555" to="+18188888884">Mar didn't answer the call.</Sms>
<Sms from="+1555555555" to="+18188888886">Vic, someone is calling you.</Sms>
<Pause length="4"/>
<Dial timeout="8" record="true"
action="mail1.php">
<Number url="whisper.xml">+18188888886</Number>
</Dial>
</Response>
<?php
}
?>
我还使用
检查了语法php -l mail.php
然后它返回
no syntax errors detected in mail.php