Gmail自动登录脚本

时间:2011-07-22 12:36:34

标签: php cakephp curl cakephp-1.3

我有gmail登录信任。 如果我们传递用户名和密码,是否可以自动登录Gmail 通过网址或CURL。

3 个答案:

答案 0 :(得分:2)

如果您右键单击gmail登录页面并查看源代码,您可以找到用户电子邮件和登录字段的ID。

然后,您可以使用这些来编写JavaScript以自动填写并提交。

这里有一个实现,您可以查看http://techtoggle.com/2009/06/how-to-autologin-into-yahoo-hotmail-lycos-mail/

编辑:它没有使用您提到的语言,但它的解决方案完全相同。此外,虽然链接网址和文章标题不提及gmail,页面上有一个gmail版本的javascript

答案 1 :(得分:1)

您可以使用Gmail IMAP界面访问所有邮件。 Retrieve Your Gmail Emails Using PHP and IMAP - 使用代码示例详细说明该过程。

答案 2 :(得分:0)

<html>
<head>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="783587177326-gtl5gpje4riio2ho6qnsfainp4a1mf5o.apps.googleusercontent.com">
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
</body>
</html>
<script>
function onSignIn(googleUser) {
  var profile = googleUser.getBasicProfile();
  console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
  console.log('Name: ' + profile.getName());
  console.log('Image URL: ' + profile.getImageUrl());
  console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
}
</script>
相关问题