Ben bir PHP newbie ve aşağıdaki yöntemi kullanarak mevcut bir PHP komut dosyası için bir ilerleme bar eklemek için çalışıyor:
$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);
//####################################################//
// This is required to curl give us some progress
// if this is not set to false the progress function never
// gets called
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
// Set up the callback
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'callback');
// Big buffer less progress info/callbacks
// Small buffer more progress info/callbacks
curl_setopt($ch, CURLOPT_BUFFERSIZE, 128);
//####################################################//
curl_exec($ch);
curl_close($ch);
fclose($fp);
The callback function :
function callback($download_size, $downloaded, $upload_size, $uploaded)
{
$percent=$downloaded/$download_size;
// Do something with $percent
echo "$percent";
}
Şimdi, ben tam anlamıyla PHP sitesinden bu örneği kopyalayıp yapıştırılan ama bu çalışmıyor? Benim PHP version Pls, 5.2.11 olduğunu. yanlış ne olabilir önermek?
Edit : I am calling this php script from another script.
Information : I am stuck with 5.2.X branch as my web-host says cPanel does not support the 5.3.x branch yet, any solutions for this ??