我有一个情况;
我通过 AJAX 调用 PHP 页面,这需要在具有电子邮件服务器权限的其他服务器上执行脚本。在数据库中输入数据后,为了更具体地了解 PHP 页面,我必须使用查询字符串中的某些参数访问电子邮件服务器。
在 index.php 页面上,我有提交按钮,该按钮通过 AJAX 调用在数据库中输入数据,然后必须向用户发送电子邮件以获取信息。但是对于电子邮件,我需要在具有电子邮件服务器访问权限的其他服务器上执行 PHP 脚本。
客户端
$.ajax({
url:'vpms/server/updating.php',
type:'POST',
data:formvalues,
success: function(data) {
closelightbox('black_overlay','vendorfeedback',ref-1,'CLOSE');
}
});
IN updating.php
enter code here
if($_POST['Type']=='SUBMITRATING')
{
$sql->Query("INSERT INTO vpms_procurement(`prno`,`vn`,`category`,`paymentterms`,`c1`,`delivery`,`c2`,`communication`,`c3`,`dated`,emaildate ) VALUES('$_POST[PRNO]','$_POST[$vendor]','$_POST[$category]','$_POST[$payment]','$_POST[$payment_txt]','$_POST[$delivery]','$_POST[$delivery_txt]','$_POST[$response]','$_POST[$response_txt]',NOW(),'$_POST[$date]')");
}
$enc=Autoloader::encrypt(serialize($array));
// Sending request to other server for email
header("Location: 10.89.6.2/managerConfirmation.php?token=$enc"); // This is not possible through ajax call
//OR
exec("10.89.6.2/managerConfirmation.php?token=$enc")
}
我可能想到的选项。
- 使用 exec("PHP 脚本?q=value");
- 或者在 Ajax 调用成功时通过 JSONP 再次调用以访问远程服务器。
但我不知道这些选项有多实用,因为我也在查询字符串中使用加密数据。