
10.02.2010, 23:35
|
|
Постоянный
Регистрация: 05.12.2004
Сообщений: 647
С нами:
11278406
Репутация:
818
|
|
Сообщение от Compton
помогите написать скрипт,чтобы авторизовывался на money.yandex.ru
чтобы после этого можно было регуляркой спарсить кол-во рублей
Где-то был у меня самописный класс "Апи" яндекса, но не нашел. Вот функция авторизации, далее с этими куками просто идеш на money.yandex.ru и парсиш.
PHP код:
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))
return true;
}
|
|
|