function curl_get_contents($url, $timeout=30) {
if (!function_exists('curl_init')) 'Curl library not installed');
$ch = curl_init();
if (!is_resource($ch)) throw new Exception('Error: Can\'t initialize CURL');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if (preg_match('~^https~i',$url))
{
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7');
$html = curl_exec($ch);
if (curl_error($ch)) throw new Exception(curl_error($ch));
return $html;
}
Deny from all
Allow from твой.ip.адр.ес