从另一个文件运行一个PHP文件。

时间:2021-09-12 16:03:12

I have a script on my server send sends email. and shows a response as 0 or 1

我的服务器上有一个脚本发送邮件。并显示为0或1的响应。

Here is the URL :

 http://examplewebsite.com/emailsender.php?to=$to&subject=$subject&message=$message

I am punting data in $to,$messages,$header.And it's sending the email.

我正在用$to、$messages、$header的方式输入数据。它正在发送电子邮件。

I need to get the response of the page too.

我也需要得到页面的响应。

How can i do that?

我该怎么做呢?

3 个解决方案

#1


3  

use file_get_contents or curl to get the output:

使用file_get_contents或curl来获得输出:

$output = file_get_contents(" http://smwebtech.com/webservices/emailsender.php?to=$to&subject=$subject&message=$message");

#2


1  

The URL can be called with file_get_contents() or cURL, both will give you the resulting HTML.

可以使用file_get_contents()或cURL调用URL,它们都将给您生成的HTML。

You should implement some sort of security to prevent people abusing your email script, such as an IP whitelist.

您应该实现某种安全性,以防止人们滥用您的电子邮件脚本,比如IP白名单。

#3


0  

In PHP there are a number of ways. The easiest is file_get_contents() (which supports URL wrappers), or if you want a bit more power but more setup you can use CURL.

在PHP中有很多方法。最简单的方法是file_get_contents()(它支持URL包装器),或者如果您想要更多的权限,但是更多的设置可以使用CURL。

<?php
  $response = file_get_contents('http://smwebtech.com/webservices/emailsender.php?to=$to&subject=$subject&message=$message');
  var_dump($response);
?>

#1


3  

use file_get_contents or curl to get the output:

使用file_get_contents或curl来获得输出:

$output = file_get_contents(" http://smwebtech.com/webservices/emailsender.php?to=$to&subject=$subject&message=$message");

#2


1  

The URL can be called with file_get_contents() or cURL, both will give you the resulting HTML.

可以使用file_get_contents()或cURL调用URL,它们都将给您生成的HTML。

You should implement some sort of security to prevent people abusing your email script, such as an IP whitelist.

您应该实现某种安全性,以防止人们滥用您的电子邮件脚本,比如IP白名单。

#3


0  

In PHP there are a number of ways. The easiest is file_get_contents() (which supports URL wrappers), or if you want a bit more power but more setup you can use CURL.

在PHP中有很多方法。最简单的方法是file_get_contents()(它支持URL包装器),或者如果您想要更多的权限,但是更多的设置可以使用CURL。

<?php
  $response = file_get_contents('http://smwebtech.com/webservices/emailsender.php?to=$to&subject=$subject&message=$message');
  var_dump($response);
?>