I have very very very basic knowledge of PHP and I need the following code which emails me everyone someone visits my page to also include in the message of the email the referring URL that landed the user on that page. That is it. I have tried a few things I read on stackoverflow but I couldnt.
Thank you!
<?php
// The message
$message = "Client has viewed the page";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);
// Send
mail('myemail@mydomain.com', 'Client 126 Viewed Biz Landing', $message);
// Redirect
header('Location: http://dazogo.com');
?>
Add $_SERVER['HTTP_REFERER']
to the contents of the e-mail.
$message = "Client has viewed the page with referer " . preg_replace('_\s_m', '', $_SERVER['HTTP_REFERER']);
The preg_replace
part is for security, it will strip away all spaces (which should not be in a URL anyway).