function getContentLength($strURL)
{
$resURL = curl_init();
curl_setopt($resURL, CURLOPT_URL, $strURL);
curl_setopt($resURL, CURLOPT_PROGRESSFUNCTION, ‘progressCallback‘);
curl_setopt($resURL, CURLOPT_NOPROGRESS, false);
curl_setopt($resURL, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec ($resURL);
curl_close ($resURL);
}
function progressCallback($resource, $download_size = 0, $downloaded = 0, $upload_size = 0, $uploaded = 0)
{
global $lens;
if ($download_size > 0) {
$res = curl_getinfo($resource);
$url = $res[‘url‘];
$pkg = strstr($url,‘?id=‘);
$pkg = str_replace(‘?id=‘,‘‘,$pkg);
$lens[$pkg] = $download_size;
return $res;
}
}