使用cURL登录ask.fm?

时间:2016-01-12 19:14:09

标签: php curl

我尝试了下面的代码,但我不知道为什么我无法登录。我看到authority_token有特殊字符。请帮帮我

function login($login, $password) {
$token = getToken();//i have got token
$curlchanel = curl_init("https://ask.fm/login");
$loginFields="login=$login&password=$password&authenticity_token=$token";
echo $loginFields;
curl_setopt($curlchanel, CURLOPT_USERAGENT, SETUSERAGENT);
curl_setopt($curlchanel, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($curlchanel, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($curlchanel, CURLOPT_HEADER, 0);
curl_setopt($curlchanel, CURLOPT_TIMEOUT, 6);
curl_setopt($curlchanel, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($curlchanel, CURLOPT_POSTFIELDS, $loginFields);
curl_setopt($curlchanel, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded; charset=UTF-8'));  
$wynik = curl_exec($curlchanel);
echo $wynik;
if ($wynik != 1) {
    echow("Unable to login");
    die;
}
curl_close($curlchanel);
}

我看到一个示例权限令牌:

  

O57WYAs / 1ueNJkBeYO + bjvrrD3hE2P6EvY / goSqxu5hWHE9MO1ZLa7hDoBQ04fqXGXTjFcAh / B + QysSht7wuSA ==

或者

  

Tk9bWOUxkxDekWQm3Q1bsGsYyOViB7osUI8LA4iVVTwjzcJ01VgOnOv0hGyJAzqpiIckiOb + uLd9yi8DFZjA7A ==

0 个答案:

没有答案