title: get file size from a url possibly have redirects
body: <p>I have tried many things including this but i can't figure out why i'm not getting it's file size.</p>
  
  <pre><code>echo remotefileSize("http://iristech.co/download/277/");
  
  function remotefileSize($url) 
  {
      $ch = curl_init($url);
      curl_setopt($ch, CURLOPT_NOBODY, 1);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
      curl_exec($ch);
      $filesize = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
      curl_close($ch);
      if ($filesize) return $filesize;
  }
  </code></pre>