It will allow you to fake http referer when sending traffic.
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.
If the script is hosted on
http://test.com
construct fake referer urls like:
http://test.com/?url=DestUrlIncludingParameters&referer=FakeRefUrl
1. Save the following code as index.php and upload to the domain of your choice. The domain will "handle" the redirections.
<?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';
}
?>
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
if ($_POST['ref_spoof'] != NULL) {
$offer = urldecode($_POST['ref_spoof']);
$p1 = strpos ($offer, '?') + 1;
$url_par = substr ($offer , $p1);
$paryval = split ('&', $url_par);
$p = array();
foreach ($paryval as $value) {
$p[] = split ('=',$value);
}
echo'<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body><form action="'.$offer.'" method="get" id="myform">';
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:
myCPAnetwork.com?oid=12345&pid=6789&sid=yy7456
The link you would post or display or send your visitors to would be:
http://test.com/?url=myCPAnetwork.com?oid=12345&pid=6789&sid=yy7456&referer=myfavewpsite.com/post-with-ads