function Host($link, $postfields = '', $cookie = '') {
$ch = curl_init($link);
addProgressInfo($ch);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.filehosts.com/');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
if ($postfields) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
}
if ($cookie) {
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
}
$page = curl_exec($ch);
return($page);
curl_close($ch);
}
function progress_info($dltotal,$dlnow,$ultotal,$ulnow){
@passthru('clear');
if($ultotal>0){
echo sprintf(" Upload: %.2f%% of %.2f MB\n"
,($ulnow/$ultotal)*100
,$ultotal/(1024*1024)
);
}
if($dltotal>0){
echo sprintf(" Download: %.2f%% of %.2f MB\n"
,($dlnow/$dltotal)*100
,$dltotal/(1024*1024)
);
}
return(0);
}
function addProgressInfo($ch){
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'progress_info');
}