title: How use CURLOPT_WRITEFUNCTION when download a file by CURL
body: <p>My Class for download file direct from a link:</p>
  
  <pre><code>MyClass{
  
            function download($link){
                  ......
                  $ch = curl_init($link);
                  curl_setopt($ch, CURLOPT_FILE, $File-&gt;handle);
                  curl_setopt($ch,CURLOPT_WRITEFUNCTION , array($this,'__writeFunction'));
                  curl_exec($ch);
                  curl_close($ch);
                  $File-&gt;close();
                  ......
  
              }
  
            function __writeFunction($curl, $data) {
                  return strlen($data);            
            } 
  }
  </code></pre>
  
  <p>I want know how to use CRULOPT_WRITEFUNCTION when download file.
  Above code if i remove line:</p>
  
  <p><code>curl_setopt($ch,CURLOPT_WRITEFUNCTION , array($this,'__writeFunction'));</code></p>
  
  <p>Then it will run good, i can download that file.But if i use CURL_WRITEFUNCTION option i can't download file. </p>