
11.02.2010, 13:52
|
|
Постоянный
Регистрация: 05.12.2004
Сообщений: 647
С нами:
11278406
Репутация:
818
|
|
Сообщение от Compton
что-то не то
PHP код:
<?php
if(login('xxxxx','xxxxxxxxx'))
echo 'auth ok<br>';
function login($login,$pass)
{
$ch = curl_init('https://passport.yandex.ru/passport?mode=auth');
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_REFERER, 'https://passport.yandex.ru/passport?mode=auth');
curl_setopt($ch, CURLOPT_COOKIEJAR, './cook.txt');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "login=$login&passwd=$pass");
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$res = curl_exec($ch);
if(preg_match('#https:\/\/passport\.yandex.ru\/passport\?mode=logout#',$res)) {
$ch = curl_init('http://money.yandex.ru/');
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_COOKIEFILE, './cook.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, './cook.txt');
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
if(preg_match_all('#<strong>.*</strong>.*</td>#', $res, $m))
print_r($m);
}
}
?>
Накидал на скорую руку, проверил, работает.
Array ( [0] => Array ( [0] => Деньги [1] => 5 руб. 36 коп. ) )
|
|
|