CodeIgniter Forums
using Curlopt_Progressfunction in codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: using Curlopt_Progressfunction in codeigniter (/showthread.php?tid=47428)



using Curlopt_Progressfunction in codeigniter - El Forum - 12-08-2011

[eluser]Unknown[/eluser]
Hi,
I have a php class to work with curl progress bar, I tested and it works on my server but when i try to implement it in codeigniter i get this error:

Quote:A PHP Error was encountered

Severity: Warning

Message: curl_exec() [function.curl-exec]: Cannot call the CURLOPT_PROGRESSFUNCTION

Code:
class download_model extends CI_Model {

function downloadIt($link){

  $targetFile = FCPATH."upload/".basename($link);
  $handle = fopen($targetFile, 'w');

   $ch = curl_init( $link );
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
   curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
   curl_setopt( $ch, CURLOPT_FILE, $handle );
   curl_setopt( $ch, CURLOPT_BUFFERSIZE, 2 );
   curl_exec( $ch );
   curl_close($ch);
}

function progressCallback( $params )
{
// some params here
}

}
( i know there are other progress method exists like APC etc but i need to use this with curl).
any help would be appreciated.
Regards