function init()
{
$this->ch=curl_init();
curl_setopt($this->ch, CURLOPT_TIMEOUT, 5);
if(!file_exists($_SERVER['DOCUMENT_ROOT']."/cookies/"))
{
mkdir($_SERVER['DOCUMENT_ROOT']."/cookies/");
}
$this->id=rand(0,100000);
$useragent="Not giving away my useragent, find your own";
curl_setopt($this->ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER ,1);
curl_setopt($this->ch, CURLINFO_HEADER_OUT, true);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT']."/cookies/cookie-jar-".$this->id.".txt");
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $_SERVER['DOCUMENT_ROOT']."/cookies/cookie-jar-".$this->id.".txt");
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION ,1);
curl_setopt($this->ch, CURLOPT_HEADER, 0);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($this->ch, CURLOPT_TIMEOUT, 5);
curl_setopt($this->ch, CURLOPT_AUTOREFERER, 0);
curl_setopt($this->ch, CURLOPT_REFERER, "");
$this->dataBuffer=array();
}
function setCookiesByID($mid)
{
$this->id=$mid;
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT']."/cookies/cookie-jar-".$mid.".txt");
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $_SERVER['DOCUMENT_ROOT']."/cookies/cookie-jar-".$mid.".txt");
}