I need to call a script called build_report.php, pass in a URL variable named partno and wait until it is finished before continuing.
我需要调用一个名为build_report.php的脚本,传入一个名为partno的URL变量,并等到它完成后再继续。
This script builds a report and then an email is sent out to our customer so I don't want the email sent until the report is generated.
此脚本构建报告,然后将电子邮件发送给我们的客户,因此我不希望在生成报告之前发送电子邮件。
Is this possible?
这可能吗?
Which should I use exec or cURL?
我应该使用exec或cURL?
2 个解决方案
#1
2
If its a local script, exec() or system() will do the trick.
如果它是本地脚本,exec()或system()将完成这一操作。
#2
1
You can call ajax request and get response from that.After getting response you can send another ajax request to send email.This code needs Jquery.
您可以调用ajax请求并从中获取响应。收到响应后,您可以发送另一个ajax请求来发送电子邮件。此代码需要Jquery。
Here is sample code for send ajax request using php.It is simple.
这是使用php发送ajax请求的示例代码。这很简单。
var passdata ="partno=5"
$.ajax({
url: "yourpath/build_report.php",
data:passdata ,
async:false,
type: "POST",
success: function(response){
if(response=="true"){
/* call send email script */
emaildata="name=vcvx"+'email="vxvx@yyy.com";
$.ajax({
url: "yourpath/build_report.php",
data:emaildata,
async:true,
type: "POST",
success: function(response){
}
});
}
} });
#1
2
If its a local script, exec() or system() will do the trick.
如果它是本地脚本,exec()或system()将完成这一操作。
#2
1
You can call ajax request and get response from that.After getting response you can send another ajax request to send email.This code needs Jquery.
您可以调用ajax请求并从中获取响应。收到响应后,您可以发送另一个ajax请求来发送电子邮件。此代码需要Jquery。
Here is sample code for send ajax request using php.It is simple.
这是使用php发送ajax请求的示例代码。这很简单。
var passdata ="partno=5"
$.ajax({
url: "yourpath/build_report.php",
data:passdata ,
async:false,
type: "POST",
success: function(response){
if(response=="true"){
/* call send email script */
emaildata="name=vcvx"+'email="vxvx@yyy.com";
$.ajax({
url: "yourpath/build_report.php",
data:emaildata,
async:true,
type: "POST",
success: function(response){
}
});
}
} });