<?
$url="http://vkontakte.ru/login.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "email=*****&pass=*****");
curl_setopt($ch, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT'].'/cookie.txt');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0.' .'(compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)');
curl_setopt($ch, CURLOPT_REFERER, $referer);
$result = curl_exec($ch);
$bpf="http://vkontakte.ru/";
curl_setopt($ch, CURLOPT_URL, $bpf);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $_SERVER['DOCUMENT_ROOT'].'/cookie.txt');//get cookie from file
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0.' .'(compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)');
curl_setopt($ch, CURLOPT_REFERER, $referer);
$result = curl_exec($ch);
echo ($result);
curl_close($ch);
?>