title: Using cURL to download a site's HTML source, but getting different file than intended
body: <p>I'm trying to use cURL and PHP to download the HTML source (as it appears in the browser) of <a href="http://www.windowsphone.com/en-US/apps/ea39f002-ac30-e011-854c-00237de2db9e" rel="nofollow">here</a>. But instead of the actual source code, this is returned instead (a meta refresh link set to 0).</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;&lt;title&gt;Object moved&lt;/title&gt;&lt;/head&gt;
      &lt;body&gt;
          &lt;h2&gt;Object moved to &lt;a href="https://login.live.com/login.srf?wa=wsignin1.0&amp;amp;rpsnv=11&amp;amp;checkda=1&amp;amp;ct=1321044850&amp;amp;rver=6.1.6195.0&amp;amp;wp=MBI&amp;amp;wreply=http:%2F%2Fwww.windowsphone.com%2Fen-US%2Fapps%2Fea39f002-ac30-e011-854c-00237de2db9e&amp;amp;lc=1033&amp;amp;id=268289"&gt;here&lt;/a&gt;.
          &lt;/h2&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm trying to spoof the referral header to be the site, but it seems I'm doing it wrong. Code is below. Any suggestions? Thanks</p>
  
  <pre><code>$ch = curl_init();
  
  curl_setopt($ch, CURLOPT_URL, 'http://www.windowsphone.com/en-US/apps/ea39f002-ac30-e011-854c-00237de2db9e');
  curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.6 (KHTML, like Gecko) Chrome/16.0.897.0 Safari/535.6'); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  curl_setopt($ch, CURLOPT_AUTOREFERER, false);
  curl_setopt($ch, CURLOPT_REFERER, "http://www.windowsphone.com/en-US/apps/ea39f002-ac30-e011-854c-00237de2db9e");
  
  $html = curl_exec($ch);
  curl_close($ch);
  </code></pre>