[TUT and CODE][UPDATED 2013] How to Fake your Referer, Fake Referrer Script

JohnsonDaniel

Regular Member
Joined
May 16, 2008
Messages
389
Reaction score
1,398
This is an update to this thread, posted in 2011:

[TUT and CODE]★★★ How to Fake your Referer, Fake Referer Any Offer, Fake Referrer Script

In that thread there were two issues:

1. Some of the code resulted in junk being appended to the link if there were no parameters used.
The code was then updated to fix that, on the 2nd page, but, so many posts on, it's hard to find.

2. The code used the split() function, which has since been deprecated in more recent PHP versions.
Unless PHP error warnings were set to "OFF" via php.ini or .htaccess, this deprecated function caused warnings
to be displayed.

What THIS thread contains is a copy-paste of the details and explanations from the previous thread,
but with
updated code, which
corrects the two issues explained above.


Here is a script I made for Content Lock Pro buyers which will provide Fake Referer functionality.

I have decided to share with BHW for free - awesome for when you don't quite have
the <cough> right <cough> type of traffic :)

It will allow you to fake http referer when sending traffic.
Spoof referer, fake http refer, fake referrer, they can all be done.

We all know the value of a decent solution, and this one works in all
browsers tested so far.

Reports on further test results are welcomed in this thread.

The requirement:

Transfer, including any parameters (even dynamically generated) to a
destination link, whilst replacing the original referer info in the surfer's
browser to a new referer of our choice.

Self-host the script which will handle the transfer.

If the script is hosted on
HTML:
http://handler.com
construct fake referer urls like:
HTML:
http://handler.com/?url=http://DestUrlIncludingParameters&referer=http://FakeRefUrl
Steps to Make this work for you:

1. Save the following code as index.php and upload to the domain of your choice. The domain will "handle" the redirections, and will not be seen:

PHP:
<?php
// Extract URI minus http://handlerdomain.com/
$full_url = urldecode($_SERVER['REQUEST_URI']);
// Extract urls we need
$l = strlen($full_url);
$p_referer = strpos ($full_url, 'referer=');
$p_dest_2 = $p_referer - 1;
$p_referer = strpos ($full_url, '=',$p_referer) + 1;
$url_referer = substr ($full_url , $p_referer);
$p_dest_1 = strpos ($full_url, '=') + 1;
$l = $p_dest_2 - $p_dest_1;
$url_dest = substr ($full_url , $p_dest_1, $l);

// Create self-posting form.
if ($url_referer != '') {
    echo '<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body>
    <form action="'.urldecode($url_referer).'" method="post" id="myform">
    <input type="hidden" name="ref_spoof" value="'.urldecode($url_dest).'">
    </form><script language="JavaScript"> document.getElementById('myform').submit();</script></body></html>';
} else {
    echo 'You must provide a referer';
}
?>
2. Insert the following code in any page (must either be a php page, or an
html page on a server which will execute php code within html files), any
WP page or post, or, if wanting to be able to use "any" post on your WP
blog as your referer, insert it in the WP header.php file (this will even permit
a fake referer to be a post which doesn't actually exist):

PHP:
<?php
if ($_POST['ref_spoof'] != NULL) {
    $offer = urldecode($_POST['ref_spoof']);
    $p1 = strpos ($offer, '?') + 1;
    $url_par = substr ($offer , $p1);
    $paryval = explode ('&', $url_par);
    $p = array();
    foreach ($paryval as $value) {
        $p[] = explode ('=',$value);
    }
    echo'<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body><form action="'.$offer.'" method="get" id="myform">';
    if ($p1 != 1) {
    foreach ($p as $value) {
        echo '<input type="hidden" name="'.$value[0].'" value="'.$value[1].'">';
    }
    }
    echo '</form><script language="JavaScript"> document.getElementById('myform').submit();</script></body></html>';
}
?>
3. Usage:

Say, for example, you upload the first file, as index.php, to handler.com,
and you place the second code in a Wordpress Header.php, on myfavewpsite.com, which, say,
has a post like: myfavewpsite.com/post-with-ads.

Now, you want to send your visitors to this offer link:

http://myCPAnetwork.com?oid=12345&pid=6789&sid=yy7456

The link you would post or display or send your visitors to would be:

HTML:
http://handler.com/?url=http://myCPAnetwork.com?oid=12345&pid=6789&sid=yy7456&referer=http://myfavewpsite.com/post-with-ads
As mentioned above, tests are welcomed, but please, if using or testing, post observed results, and
leaks, if any (there shouldn't be, ever) in this thread.

Also, this will not work to use ASP-based pages as the fake referer, the page must be able to interpret php
code (most servers do).

Finally, if you end up on a 403-Forbidden page, you need to ask your host to add an exception rule to MOD_Security to allow PHP redirections.


Feel free to check other threads started by me to find my other shares:

1. Content Locking Methods to make $$$ per day:

a) [METHOD Step-by-Step with CODE] My Twisted Method to $1k+ a week - NOOB friendly

b)
My Twist to Content Locking for $80 a day

2. Yourls Plugin, Shorten a Url, Iframe the Destination, and Execute Code (locker or other code):

a) [SCRIPT] Shortener with iFrame and any code you like - Gauging interest, will release free

b)
[GET] Plugin - Url Shortener - Create Iframe Of Long Url - Lock It Or Call Any Code

3. Use your US-based VPS as a secure VPN for your private use.

[METHOD] Got Server/VPS? Need an IP? Private VPN on your Server

4. Send postbacks from your OWN thank-you page to any postback script or
url (thank-you for completing offer, for submitting email, whatever):

[SHARE] Set up postbacks for conversion tracking. No Tracking = No Money!

ENJOY!

If you like my stuff, please post on the threads with your thoughts, your mods, your methods or your spins.

Please - no PMs, keep questions to the relevant threads.
 
Damn... I'd like to learn this but I have no time. What's the difference in using this script with Easy Redirect Script? I am using easy redirect for a year now but I want to know this as well.

Thanks for your answers!
 
I'm not familiar with that script but I can see two main differences:

1. It's $77! Mine is shared FREE

&

2. Looks to me like that script is used to hide your destination from your traffic. i.e. so your traffic doesn't know where they will end up, nor do they know you're an affiliate.
My script is used to hide your traffic sources from the destination, ie so the owner (advertiser or Network) of your affiliate offer does not know where your traffic is coming from.
In this regard, they have opposite functionality.

Damn... I'd like to learn this but I have no time. What's the difference in using this script with Easy Redirect Script? I am using easy redirect for a year now but I want to know this as well.

Thanks for your answers!
 
just implemented this and the redirect is not working as it should - it redirects to the referrer. also you need to escape ('myform')

Edit: Now redirects as it should - its been a long day! but you still need to escape
('myform'), replace all instances of ('myform') with (\'myform\')
 
Last edited:
just implemented this and the redirect is not working as it should - it redirects to the referrer. also you need to escape ('myform')

Edit: Now redirects as it should - its been a long day! but you still need to escape
('myform'), replace all instances of ('myform') with (\'myform\')


I just implemented this also and yes, it redirects to the referrer. How did you fixed it?
 
I just implemented this also and yes, it redirects to the referrer. How did you fixed it?

That's normally caused by MOD_Security. Just ask your host to enable a MOD_Sec rule to allow PHP redirections and it should then work.
 
Well let's say if I don't enter anything for the referrer filed, then will it blank the referrer?
 
Hey nice script!
I've tried to implement it and I get this error:

Parse error: syntax error, unexpected 'myform' (T_STRING), expecting ',' or ';' in /home/xxxxx/public_html/index.php on line 19
 
Well let's say if I don't enter anything for the referrer filed, then will it blank the referrer?

No, search my username for threads started by me...I shared a referer blanker which you should use instead

Hey nice script!
I've tried to implement it and I get this error:

Parse error: syntax error, unexpected 'myform' (T_STRING), expecting ',' or ';' in /home/xxxxx/public_html/index.php on line 19

Try escaping 'myform' as suggested by another user (i.e. replace 'myform' with \'myform\')
 
Hi
First, thank you for the script.

I was wandering if you could help me.
I made a fake referral script that rotates url's randomly and it works fine.
Now I would like to add a fake referrer and user agents in it.
I found some tutorials online (using PHP, curl and javascript) but since I am not that great with the code yet I don't understand how to proceed.
The guy gave the code but didin't say if it has to be in the same file and I don't know where the referring url's go and user agents ...
I wonder if you have an idea how to proceed about it?
 
Not working, always redirects to Referer. (mod_security) is disabled.
 
Hi JohnsonDaniel, first of all, thanks you for this wonderful script, it works like a charm, except for one thing;

As mentioned here above sometimes a "?" is added at the end of the URL and therefor some of my affiliate links don't work. It would be amazing if you could help us out with a fix :)

Thanks in advance!
 
Back
Top