1

I have file html like example.php

Url <a href="<? echo $var ?>"><? echo $var ?></a>

and i want send mail with this file with variable defined in send.php

<?php
$var = "someurl";
$contents = file_get_contents("example.php");
mail("[email protected]", "x", $contents");
?>

And my problem is this that send.php send Url <a href="<? echo $var ?>"><? echo $var ?></a> instead

Url someurl

where someurl is hyperlink.

I tried with fread() but the effect is the same.

Anyone have any ideas how to do it?

1 Answer 1

2

You can use Php's output buffering and an include:

<?php
$var = "someurl";
ob_start();
include 'example.php';
$contents = ob_get_clean();
mail("[email protected]", "x", $contents);
?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.