Forum Moderators: coopster

Message Too Old, No Replies

knowing from which page a conversion has come

         

smallcompany

8:51 pm on Jun 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If I have a page like:

example.com/page1.html

and on that page I have an outgoing affiliate link like:

/links/link.php?s=link1

and in link.php I have:

if ($_GET['s']; == "link1") {$link = "example2.com";}
header("Location: $link");

In the above steps, how do I get that "page1.html" (the page where the link has been clicked onto) so I can insert it as a variable to the end of my $link?

That would tell me the originating page of my sale.

Thanks

Tommybs

10:42 pm on Jun 10, 2010 (gmt 0)

10+ Year Member



If I understand you correctly I believe what you are looking for is $_SERVER['HTTP_REFERER'];

Best to sanitize the data first though to make sure it's legit.


Thanks

smallcompany

11:30 pm on Jun 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Why was that so hard for me? I remember trying something with "current page" which (obviously) did not work, and I left it there.

Programming...

Thanks very much.

Edit:

BTW, once I get the full referrer, how do I trim the URL? For example:

The full referrer is http://www.example.com/page.html

I just want that "page.html" or even just "page" to be passed on.

Later I may want to use short codes for smaller sites (like "page = 01").

Thanks

New edit:

Found it: basename