Posted by deko on 02/08/07 08:08
I need to capture referrers to a website and populate a page with links to the
referring pages.
How do I use preg_replace to search for and replace all ampersands ('&') with
the corresponding HTML special character ('&')?
$refurl = trim(getenv("HTTP_REFERER"));
$refhost = parse_url($refurl);
$refhost = preg_replace("\&\", "\&\", $refhost);
This code returns a warning and an error:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in ...
Parse error: parse error, unexpected ';' in ...
Thanks in advance.
Navigation:
[Reply to this message]
|