public function postCheckValidAuth() {
$username = $this->request->getContent['login'];
$password = $this->request->getContent['password'];
$url = 'https://store.steampowered.com/login/getrsakey/';
$data = ['username' => $username, 'password' => $password];
$result = $this->post($url, $data);
$result = json_decode($result);
$rsa = new RSA();
$key = [
'modulus' => new BigInteger($result->publickey_mod, 16),
'publicExponent' => new BigInteger($result->publickey_exp, 16)
];
$rsa->loadKey($key, RSA::PUBLIC_FORMAT_RAW);
$password = base64_encode($rsa->encrypt($password, false));
$captchaGid = -1;
$captchaText = '';
$emailAuth = '';
$emailSteamId = '';
$data = [
'username' => $username,
'password' => $password,
'rsatimestamp' => $result->timestamp,
'captcha_gid' => $captchaGid,
'captcha_text' => $captchaText,
'emailauth' => $emailAuth,
'emailsteamid' => $emailSteamId
];
$url = 'https://store.steampowered.com/login/dologin/';
$result = $this->post($url, $data);
$result= json_decode($result);
$this->response->setJsonContent($result)->send();
}
private function post($url, $data) {
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36');
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, http_build_query($data));
$query = curl_exec($curl_handle);
curl_close($curl_handle);
return $query;
}
Что то не так с закодированием пароля?
Постоянно выдает что пароль не правильный, хотя он правильный на 100%.