<?php
# класс curl
# author Drk in
class curl {
function get($url,$tpage,$post = null) # подключение по curl к сайту
{
$curl = curl_init();
$ua = 'Nokia 6230';
$headers = array(
'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Language:ru,en-US;q=0.8,en;q=0.6,uk;q=0.4',
'Referer:' . $url,$ua);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, $ua);
curl_setopt($curl, CURLOPT_REFERER, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_COOKIEJAR, cache.'_cookies/'.$tpage.'.dat');
curl_setopt($curl, CURLOPT_COOKIEFILE, cache.'_cookies/'.$tpage.'.dat');
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_HEADER, 1);
if($post != null) :
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
endif;
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
$cnt = curl_exec($curl);
curl_close($curl);
return $cnt;
}
}
?>