title: cURL returns binary data instead of html
body: <pre><code>function curl($url) {
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/25.0.1");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_COOKIE, 'long cookie here');
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  $output = curl_exec($ch);
  curl_close($ch);
  return $output;
  
  }
  </code></pre>
  
  <p>The original url I'm feeding it is <a href="http://example.com/i-123.html" rel="noreferrer">http://example.com/i-123.html</a> but if I open in browser, I get redirected to <a href="https://example.com/item-description-123.html" rel="noreferrer">https://example.com/item-description-123.html</a> (so I added <code>CURLOPT_FOLLOWLOCATION</code>).</p>
  
  <p>However, the output of this function is binary data. </p>
  
  <pre><code>1f8b 0800 0000 0000 0003 ed7d e976 db38
  f2ef e7f8 2930 9ac9 d86e 9b92 b868 f3a2
  3e5e 9374 67fb c7ee 74f7 e4e6 f880 2428
  31a6 4835 172f 3dd3 8f74 3fde 17b8 f7c5
  6e15 008a 8ba8 2db1 3ce9 25a7 dba4 4810
  ......
  </code></pre>
  
  <p>How do I fix this? I tried adding</p>
  
  <pre><code>curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); 
  </code></pre>
  
  <p>(copied from somewhere). Didn't work.</p>
  
  <p><code>file_get_contents()</code> gives me the same output.</p>