Welcome Guest, Not a member yet? Register   Sign In
using Curlopt_Progressfunction in codeigniter
#1

[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




Theme © iAndrew 2016 - Forum software by © MyBB