Hi I am looking to replace words in an html email I am loading via file_get_contents
Here is my code:
<?
$message = file_get_contents("http://www.MYwebsiteExample.com/EmailConfirmation.php");
$message = preg_replace('/SAD/', "HAPPY", $message);
// Also tried this below and it does not work either
$message = str_replace('/SAD/', "HAPPY", $message);
?>
I am hoping to find all the patters of SAD (case sensitive) and replace them with HAPPY. For some reason if I use file_get_contents it doesn't seem to be working.
Thanks
UPDATE: Jan 22, 2013
Actually, sorry Correction when I add the $ it does not work. Its not necessary for my code. I can do a work around but this does not work below:
$message = str_replace("$SAD", "HAPPY", $message); /// does not work. Not sure why
$message = str_replace("SAD", "HAPPY", $message); /// without the $ it does work.