Jump to content

Archived

This topic is now archived and is closed to further replies.

sprinjee

Variable from SERVER['HTTP_REFERER']

Recommended Posts

When doing echo $_SERVER['HTTP_REFERER'] I see the information:

[a href=\"http://www.koenvissers.nl/survey/survey.php?uid=14482e0bec0181&linkcode=Ef0004\" target=\"_blank\"]http://www.koenvissers.nl/survey/survey.ph...linkcode=Ef0004[/a]

How can I extract Ef0004 from $_SERVER['HTTP_REFERER']?

Share this post


Link to post
Share on other sites
couple of useful linkies

[a href=\"http://www.php.net/preg_match\" target=\"_blank\"]http://www.php.net/preg_match[/a]

[a href=\"http://www.php.net/regex\" target=\"_blank\"]http://www.php.net/regex[/a]

Share this post


Link to post
Share on other sites
thx...

Solved it:

$lnkcod = str_replace("http://www.koenvissers.nl/survey/survey.php?uid=14482e0bec0181&linkcode=", "" , $_SERVER['HTTP_REFERER']);

Share this post


Link to post
Share on other sites
This is not going to work if there are any small differences in the URL.
You should use true regex.

If you tell me what you expect linkcode to be (what is it's length? alphanumeric only? is it always in the end of the URL) I can give you a regular expression...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.