sohel14_cse_ju
sohel14_cse_ju

Reputation: 2521

Run a PHP file from another file

I have a script on my server send sends email. and shows a response as 0 or 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.

I need to get the response of the page too.

How can i do that?

Upvotes: 1

Views: 115

Answers (3)

MrCode
MrCode

Reputation: 64536

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

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

Upvotes: 1

LeonardChallis
LeonardChallis

Reputation: 7783

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

Upvotes: 0

Andrew Hall
Andrew Hall

Reputation: 3073

use file_get_contents or curl to get the output:

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

Upvotes: 3

Related Questions