I am new to PHP and trying to add a progress bar to an existing PHP script using the following method:
$ch=curl_init() or die("ERROR|<b>Error:</b> cURL Error"); curl_setopt($ch, CURLOPT_URL, $c); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_FILE, $fp); //
Callback function:
function callback($download_size, $downloaded, $upload_size, $uploaded) { $percent=$downloaded/$download_size; // Do something with $percent echo "$percent"; }
Now I literally copied this example from a PHP site, but this does not work? My PHP version is 5.2.11, Pls. what could be wrong?
Edit: I call this php script from another script.
Info: I am stuck with 5.2.X branch as my web host says cPanel does not yet support 5.3.x branch, any solutions for this
source share