| не могу найти ошибку по авторизации на мейле
<?php
if (ini_get('display_errors') != 1) { // проверяет значение опции display_errors
ini_set('display_errors', 1); // включает вывод ошибок вместе с результатом работы скрипта
};
if(isAuth("tempoa@list.ru","tempoa123") )
{
$ch=curl_init();
//curl_setopt($ch, CURLOPT_URL, 'http://blogs.mail.ru/cgi-bin/journal/jupdate');
curl_setopt($ch, CURLOPT_URL, 'http://mail.ru/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3');
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_REFERER, 'http://mail.ru/');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
// "-----------///////////--результат->";
echo $result = curl_exec($ch);
}
function isAuth($email,$password)
{
global $cookie_file_path;
list($maillogin,$domain) = explode("@",$email);
$cookie_file_path = realpath(dirname(__FILE__))."/ff/cookie_$maillogin.txt"; //для обычного хостинга
//if (!is_writeable($cookie_file_path)) die ("Error not writable cookie to $cookie_file_path");
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://auth.mail.ru/cgi-bin/auth');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3');
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.mail.ru/'); //Referer: http://www.mail.ru/
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
//curl_setopt($ch, CURLOPT_POSTFIELDS,'page=http%3A%2F%2Fblogs.mail.ru&Login='.$maillogin.'&Domain='.$domain.'&Password='.$password);
curl_setopt($ch, CURLOPT_POSTFIELDS,'Login='.$maillogin.'&Domain='.$domain.'&Password='.$password);
//curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
echo $result = curl_exec($ch);
if(preg_match("#checkcookie#",$result)) {
return true;
}else return true;
}
?>
|
| |