Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send referer with header

Status
Not open for further replies.

blekfis

Programmer
Oct 19, 2001
38
0
0
SE
I'm redirecting traffic via this (in short...):
header("Location: " . $html->param('redirect'));

Only problem is that the recieving website doesn't get any referer-info, and since I'm redirecting for affiliation I don't get paid :(

Is there a way of sending clicks thru my page to reciever so that it's counted as if it came from my site. I cannot do this since I offer subdomains to people and when they click referer will be sub.mydomain.com, that doesn't count. The only way for me would be adding each subdomain at the affiliateprogram, but if there's an easier way... ;)
 
You could have a link on the first page that sends the user to somewhere.yourdomain.com (where somewhere is the subdomain that counts), and in the somewhere.yourdomain.com page use $_GET or $_POST to get the affiliate's name, and use header("Location: ..."); as needed.

-> LuckySyringe
 
When a user clicks the ad (<a href="page.php?redirect= it sends them to my redirect-page at (that counts). Code I've tried so far to redirect and send as referer:

<?php
$redir = $_GET["redirect"];
header("Location: $redir");
?>

- - - - - - - - - - - - - - - - - - - - - - - - - -
Then I found some info on php.net:

Unfortunately IE (Internet Explorer) doesn't support HTTP_REFERER if the link is not a plain html link.
I am using the following code at the end (!) of all php/html code (using an insert file):
<?php
$_SESSION['HTTP_REFERER'] = basename($_SERVER['PHP_SELF']);
?>


<?php
$redir = $_GET["redirect"];
header("Location: $redir");
$_SESSION['HTTP_REFERER'] = basename($_SERVER['PHP_SELF']);
exit;
?>

- - - - - - - - - - - - - - - - - - - - - - - - - -

and finally tested:

<?php
$redir = $_GET["redirect"];
?>
<html>
<META HTTP-EQUIV=Refresh CONTENT="1; URL=<?php echo $redir; ?>">
<body>
Redirecting...
</body>
</html>
 
Since no answer I guess it's impossible to do it the way I need...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top