简体   繁体   English

如何获取电子邮件页面并向其提交表单数据?

[英]How can I fetch an email page and submit form data to it?

I was trying to automate login to my emails through my own website. 我试图通过自己的网站自动登录电子邮件。 Here is what I have managed till now. 这是我到目前为止所管理的。 I don't want to save my data on my computer because it is a shared one. 我不想将数据保存在计算机上,因为它是共享的。

<?php

$src=file_get_contents('https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=http://mail.google.com/mail/&scc=1&ltmpl=default&ltmplcache=2');

?>

<html>
<body>
<?php echo $src; ?>

<script>
window.onload = function() {
 document.getElementsByName('Email').item(0).value='testusername@gmail.com';
 document.getElementsByName('Passwd').item(0).value='testpassword';
 document.getElementsByName('signIn').item(0).click();
 void(0);
}
</script>

</body>
</html>

Why does this not work? 为什么这不起作用? Any ideas? 有任何想法吗? I'm new to web programming, so any help or suggestions would be appreciated. 我是Web编程的新手,所以任何帮助或建议都将不胜感激。

It's not possible. 这是不可能的。 Google deny executing of authorisation requests using scripts. Google拒绝使用脚本执行授权请求。 There are some ways to prevent this behaviour. 有一些方法可以防止这种行为。 I'm sure Google does all necessary things for it. 我确定Google会为此做所有必要的事情。

I can suggest you to use Lastpass browser extension to autologin. 我建议您使用Lastpass浏览器扩展程序自动登录。 In has the master password that you must to remember. 输入具有您必须记住的主密码。 It's secure enough even for computers with public access. 即使对于具有公共访问权限的计算机,它也足够安全。 Until someone get your master password, he doesn't have access to all your saved passwords. 在某人获得您的主密码之前,他无权访问您所有已保存的密码。

But nothing can protect you from keyboard loggers and network sniffers. 但是,没有什么可以保护您免受键盘记录器和网络嗅探器的攻击。 So it's totally hopeless. 因此,这完全是没有希望的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从另一个页面提交包含现有数据的表单? - How can I submit a form from another page with existing data? 如何在不重新加载页面的情况下提交表单 - How can I submit a form without reloading the page 需要后如何提交表单并保持在同一页面上? - How can I submit form and stay on the same page after require? 在较大的表单中上传文件(一页上有两个表单),我如何一次提交两组数据(文件和表单)? (PHP) - Uploading files within a larger form (two forms on one page), how can I submit both sets of data (file and form) at once? (PHP) 用户点击提交后,页面跳转到php文件。 它如何保留在 HTML 文件中并将表单信息提交到电子邮件? - After the user clicks submit, the page goes to the php file. How can it remain on the HTML file and submit the form information to the email? 如何通过Ajax提交包含数据和文件的表单 - How can I submit a form with data and files by ajax 我怎样才能将表单数据作为邮件发送并仍然提交 - How can i Send form data as mail and still submit HTML表单的提交按钮如何在不打开用户电子邮件客户端并随后重定向到另一个页面的情况下向网站管理员发送电子邮件? - How Can Submit Button of HTML Form send email to webmaster without opening user's email client and redirect to another page afterwards? 如何使用香草 JS 从表单提交的公共 API 获取数据 - How do I fetch data from a public API on form submit using vanilla JS 将表单数据提交到电子邮件文件夹 - Submit form data to email folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM