<?php
function CURLProgress($dltotal, $dlnow, $ultotal, $ulnow)
{
// clear actual ligne
echo ' ' . "\r";
if($dltotal == 0)
{
$num = (int)($dlnow / 1024);
$rem = (int)($dlnow % 1024);
echo $num . '.' . $rem . 'Ko ';
}
else
{
$num = (int)($dlnow / 1024);
$rem = (int)($dlnow % 1024);
$tot_num = (int)($dltotal / 1024);
$tot_rem = (int)($dltotal % 1024);
echo $num . '.' . $rem . 'Ko / ' . $tot_num . '.' . $tot_rem;
}
// use when uploading data...
if($ultotal == 0)
{
}
else
{
}
return 0; // return 1 to cancel
}
include('./curl.wrapper.php');
$curl = new CCurlWrapper();
if($curl->InitEx() === false)
die('Unable to init the CURL library' . "\n");
$curl->SetProgress('CURLProgress');
// request is about ~5MO
$curl->Exec('http://www.sudexpress.com/media/files/LookBook_automne-hiver_13_3_.pdf');
echo "\n";
echo 'HTTP Code: ' . $curl->GetReturnCode() . "\n";
$i_ft = $curl->GetFileTime();
if($i_ft!= -1)
echo 'File time: ' . $i_ft . "\n";
else
echo 'File time: Unavailable' . "\n";
echo 'Total time: ' . $curl->GetTotalTime() . "\n";
echo 'DNS Resolve time: ' . $curl->GetNameLookupTime() . "\n";
echo 'Connect time: ' . $curl->GetConnectTime() . "\n";
echo 'Pre-transfer time: ' . $curl->GetPreTransferTime() . "\n";
echo 'Start transfer time: ' . $curl->GetStartTransfertTime() . "\n";
$redir_count = $curl->GetRedirectCount();
echo 'Number of redirection: ' . $redir_count . "\n";
if($redir_count > 0)
{
echo 'Final URL: ' . $curl->GetEffectiveUrl() . "\n";
echo 'Rediection time: ' . $curl->GetRedirectTime() . "\n";
}
echo 'Upload size: ' . $curl->GetSizeUpload() . "\n";
echo 'Upload speed: ' . $curl->GetSpeedUpload() . "\n";
echo 'Download size: ' . $curl->GetSizeDownload() . "\n";
echo 'Download speed: ' . $curl->GetSpeedDownload() . "\n";
echo 'Content type: ' . $curl->GetContentType() . "\n";
?>
|