I'm trying to send a webpage as an email. The content of this webpage is based on variables, which are called using the _GET method.
I have this part of code, which works if I don't put any variables in the url, but echoes [function.file-get-contents]: failed to open stream: No such file or directory in...
as soon I write ?variable=
behind the URL.
<?
$var_one = $_GET['var_one'];
$var_two = $_GET['var_two'];
$from = "Company name";
$from_email = "company@mail.com";
$email_text = file_get_contents("mail_this_page.php?varone=".$var_one."&vartwo=".$var_two);
$headers = "From:abc@mail.com";
$headers = "From: $from <$from_email>\r\n".
"MIME-Version: 1.0" . "\r\n" .
"Content-type: text/html; charset=UTF-8" . "\r\n";
mail('guest@mail.com', 'Hello', $email_text, $headers);
?>
So, the problem is in the file_get_contents
line.
$email_text = file_get_contents("mail_this_page.php");
works, but
$email_text = file_get_contents("mail_this_page.php?varone=".$var_one."&vartwo=".$var_two);
doesn't. What am I doing wrong? How can I pass the variables using this method?