title: Why can't get the length of the iso file with `CURLINFO_CONTENT_LENGTH_DOWNLOAD` in php_curl?
body: <p>I want to get the length of the iso file on the web</p>
  
  <p><a href="http://cdimage.debian.org/debian-cd/8.0.0/i386/iso-cd/debian-8.0.0-i386-lxde-CD-1.iso" rel="nofollow">http://cdimage.debian.org/debian-cd/8.0.0/i386/iso-cd/debian-8.0.0-i386-lxde-CD-1.iso</a></p>
  
  <pre><code>&lt;?php
      $szUrl = 'http://cdimage.debian.org/debian-cd/8.0.0/i386/iso-cd/debian-8.0.0-i386-lxde-CD-1.iso';
      $curl = curl_init();
      curl_setopt($curl, CURLOPT_URL, $szUrl);
      curl_setopt($curl, CURLOPT_HEADER, 1);
      curl_setopt($curl, CURLOPT_NOBODY, 1);
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
      $size = curl_getinfo($curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
      echo $size;
  ?&gt;
  </code></pre>
  
  <p>The output is -1 with the code,How to get the length of the iso file properly with php_curl?<br>
  With the answer of Leggendario , the key of my problem is to set 
  CURLOPT_FOLLOWLOCATION to get right answer.<br>
  It makes my question different from the <code>http://stackoverflow.com/questions/2602612/php-remote-file-size-without-downloading-file</code>.</p>