2015-03-15

Hey everyone, I used too use CPA Redirector 2 a few years ago, but the author of that plugin closed his site down, so I decided to write a quick, simple script to fake the HTTP referrer. I will also explain how to use it.

Let's say you have an offer on a CPA network where Facebook traffic is not allowed, but you want too promote that offer on Facebook. Obviously your network wouldn't be OK with that, because they check the HTTP referrer for any requests too your affiliate link. So, what you want to do is fake the referrer, and make sure one is sent to your affiliate link that is not from facebook.com

The trick to doing this is to place this code ABOVE THE <HTML> TAG on a "white hat" page promoting the offer you are spamming, make sure this page is following your CPA networks rules for that offer, such as no use of the word "Free".

Code:

<?php

$secret = "secretpassword";

$afflink = "http://afflinkhere.com/";

if ($_GET["token"] == $secret) {

$url = strtok($_SERVER["REQUEST_URI"],'?');

setcookie("var", $secret, time()+3600);  /* expire in 1 hour */

echo "<script>window.location.href = \"" . $url . "\"</script>";

}

if (isset($_COOKIE["var"]) && $_COOKIE["var"] == $secret) {

setcookie("var", "", time()-3600);  /* unset cookie */

echo "<script>window.location.href = \"" . $afflink . "\"</script>";

}

?>

Let's assume that your white hat url where you placed this code is http://whitehat.com/some-landing-page.php

Now the link you would want to spam on facebook (after using a URL shortener) would be http://whitehat.com/some-landing-pag...secretpassword

The beauty of this is, if you do not add ?token=secretpassword too the URL, some-landing-page.php will show it's normal, white hat content. And when your affiliate manager checks your traffic logs and referrers, they will see http://whitehat.com/some-landing-page.php, without the secret token. Also the code I posted above will not appear if they view the source of your page, since it is written in PHP, only someone with access too your server or knows the secret password will know it's there.

I know this is a super-simple form of faking the referrer, but it works in the latest version of all major browsers. Make sure you change the hardcoded secret password and affiliate link, and place the code ABOVE THE <HTML> TAG on the page you want your affiliate manager too think your traffic is coming from.

Show more