gpt4 book ai didi

java - HTTP Google 登录 - Cookie 已关闭

转载 作者:行者123 更新时间:2023-12-01 04:56:21 26 4
gpt4 key购买 nike

我正在尝试登录我的 Google 帐户。我在旧帖子中读到过使用 HTTP-Fox获取所有参数。所以我添加了所有内容,包括隐藏的内容。

package com.businessLogic;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;

public class Browser {
public static void main (String [] arg ){

HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("https://accounts.google.com/ServiceLogin");
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("service", "lso"));
nameValuePairs.add(new BasicNameValuePair("passive", "1209600"));
nameValuePairs.add(new BasicNameValuePair("continue", "https://accounts.google.com/o/oauth2/auth?....."));
nameValuePairs.add(new BasicNameValuePair("ltmpl", "embedded"));
nameValuePairs.add(new BasicNameValuePair("shdf", "CoMBCxIRdGhpcmR...."));
nameValuePairs.add(new BasicNameValuePair("scc", "1"));
nameValuePairs.add(new BasicNameValuePair("dsh", "-2602464068824153107"));
nameValuePairs.add(new BasicNameValuePair("GALX", "qqYU2P_8USM"));
nameValuePairs.add(new BasicNameValuePair("pstMsg", "1"));
nameValuePairs.add(new BasicNameValuePair("dnConn", ""));
nameValuePairs.add(new BasicNameValuePair("checkConnection", "youtube:816:1"));
nameValuePairs.add(new BasicNameValuePair("checkedDomains", "youtube"));
nameValuePairs.add(new BasicNameValuePair("timeStmp", ""));
nameValuePairs.add(new BasicNameValuePair("secTok", ""));
nameValuePairs.add(new BasicNameValuePair("_utf8", "â"));
nameValuePairs.add(new BasicNameValuePair("bgresponse", "!A0LfAt2vXHmPiURq..."));
nameValuePairs.add(new BasicNameValuePair("Email", "XXX"));
nameValuePairs.add(new BasicNameValuePair("Passwd", "XXX"));
nameValuePairs.add(new BasicNameValuePair("signIn", "Anmelden"));

post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = "";
while ((line = rd.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

回应:

<html><head><title>Google Accounts</title>
</head>
<body dir="ltr" bgcolor="#ffffff" text="#000000" link="#0000cc" vlink="#551a8b" alink="#ff0000">
<div class="topbar aligns" style="font-size:smaller; margin-bottom:0 15px 1px 15px; white-space:nowrap;">
<a>
Google Home
</a>
|

<a>Sign in</a></div>
<div class="header margins" style="height: 40px; margin: 13px 15px 9px 15px;"><a href="https://accounts.google.com/"><img src="/googleaccountslogo/en.gif" border="0" class="floats-normal" alt="Google"></a>
</div>
<div style="clear:both;"></div>
<div class="body"><p>Your browser&#39;s cookie functionality is turned off. Please turn it on.
[<a href="http://www.google.com/support/accounts/bin/answer.py?answer=61416&amp;hl=en&amp;ctx=ch_ServiceLogin&amp;p=lso" target="_blank">?</a>]</p>
&copy;2012 Google

</body></html>

登录失败。 “登录”选项也可用。我不知道如何处理这些答案/Cookie。我找不到有用的解决方案,因为每个人都使用旧的 API,其中 httpclientorg.apache.common.* 的一部分。

那么你能帮我吗?

最佳答案

httpFox 将向您显示 FireFox 中请求的 cookie。查看这些 cookie,它应该可以为您提供一些线索。显然,必须存在一个或多个 cookie,该 URL 才能回答您的问题。

http 客户端可以指定通过请求/POST 传递 cookie。

关于java - HTTP Google 登录 - Cookie 已关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14071269/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com