title: redirect and fake the referer at the sametime
body: <p>Is there a way to redirect the user to another site and fake the referrer at the same time.?
  Tried this with my code, i know its wrong but thats only how far i can get.</p>
  
  <pre><code>&lt;?php
      $page1 = "http://google.com"; $page2 = "http://yahoo.com/";
      $mypages = array($page1,$page2); 
      $myrandompage = $mypages[mt_rand(0, count($mypages) -1)];
      $sites = array_map("trim", file("links.txt"));
      $referer = $sites[array_rand($sites)];
  
  function fake_it($url, $ref, $agent) 
  { 
    $curl = curl_init(); 
    $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,"; 
    $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; 
    $header[] = "Cache-Control: max-age=0"; 
    $header[] = "Connection: keep-alive"; 
    $header[] = "Keep-Alive: 300"; 
    $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"; 
    $header[] = "Accept-Language: en-us,en;q=0.5"; 
    $header[] = "Pragma: "; // browsers keep this blank. 
  
    curl_setopt($curl, CURLOPT_URL, $url); 
    curl_setopt($curl, CURLOPT_USERAGENT, $agent); 
    curl_setopt($curl, CURLOPT_HTTPHEADER, $header); 
    curl_setopt($curl, CURLOPT_REFERER, $ref); 
    curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate'); 
    curl_setopt($curl, CURLOPT_AUTOREFERER, true); 
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($curl, CURLOPT_TIMEOUT, 5000); 
  
    $html = curl_exec($curl);
    curl_close($curl);
  
    // returns the content provided by the site
    return $html;
  }
  
  //Below would send a request to the url, with the second parameter as the referrer
  echo fake_it($myrandompage, $referer,$_SERVER['HTTP_USER_AGENT']);
  
  ?&gt;
  </code></pre>
  
  <p>what i want is to go from refer.php -> google.com(referer = some other url)..</p>