function get_url($url,$ref='',$header='',$post='',$cookie='',$cookiefile='',$proxy='',$timeout='',$popitok=2) {
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if($ref!='') curl_setopt($ch, CURLOPT_REFERER, $ref);
if($header!='') curl_setopt($ch, CURLOPT_HEADER, 1);
if($post!='') { curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post); }
if($cookie!='') curl_setopt($ch, CURLOPT_COOKIE, $cookie);
if($cookiefile!='') { curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile); }
if($proxy!='') curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($timeout!='') curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
$i=0;
do {
$i++;
print '<!---->'; flush();
$content = curl_exec ($ch);
} while($i<$popitok && $content=='' || curl_errno($ch)!=0 && $i<$popitok);
if(curl_errno($ch)!=0 || $content=='') {
curl_close ($ch);
return false;
} else {
curl_close ($ch);
return $content;
}
}