Bryan99
Bryan99

Reputation: 19

Fake referrer not working

I'm using this code for to fake the referrer of a user when he clicks on my link, to make it look like he's coming from Facebook:

 <?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://bit.ly/randomurl');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, 'https://www.facebook.com/')
$html = curl_exec($ch);   
?>

But it doesn't seem to be working, as the referrer I see is the url of the code above. How can I fix it? And I really could appreciate some help with the coding as I'm not a coder.

Upvotes: 1

Views: 1277

Answers (1)

Quentin
Quentin

Reputation: 943578

I'm using Live HTTP Headers from Mozilla

You are examining the headers sent by Firefox, but the referer header you are setting manually is being sent by PHP/cURL. That is a different HTTP client and a different set of HTTP requests.

  1. Firefox will request your PHP program (and send normal referer headers to it).
  2. Your PHP program will request http://bit.ly/randomurl (and send the referer header you manually specify to it).
  3. http://bit.ly/randomurl will respond to your PHP program.
  4. Your PHP program will respond to Firefox.

Upvotes: 2

Related Questions