使用Curl登录到Gmail收件箱? [英] Login to Gmail Inbox using Curl?

查看:132
本文介绍了使用Curl登录到Gmail收件箱?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,用户将首先保存他的gmail ID和密码,确认后,我将提供一个链接,用于下次直接登录gmail,而无需输入他的gmail ID和密码。.保存的密码将以使用CURL的userid和passwd参数

I'm doing a project where user will first save his gmail id and password and after confirmation,I will provide a link for directly login to gmail next time without entering his gmail id and password.. the saved password will passed as a parameters of userid and passwd using CURL

我正在使用php ..我听说过curl可以做到这一点。.我尝试了很多代码,但是没有得到任何有效的代码..谁能告诉我..我如何在PHP中使用CURL登录gmail收件箱..

I'm doing this using php.. I heard about curl to do this.. I tried lots of code but didn't get any working code.. Can anyone tell me.. how do i just login to gmail inbox .. using CURL in PHP ??

推荐答案

如果您只想阅读Gmail收件箱中的电子邮件,则应该放弃cURL伪浏览器路径;而是在Gmail帐户上启用POP或IMAP ,并使用PHP出色的 IMAP / POP3函数访问Gmail收件箱。

If you're just interested in reading the emails in a Gmail inbox you should forgo the cURL pseudo-browser path; instead, enable POP or IMAP on the Gmail account and use PHP's excellent IMAP/POP3 functions to access the Gmail inbox.

另一方面,如果您尝试创建某种单点登录服务,那您就很不走运了。为什么是这样?好的,即使您的服务器设法通过Gmail验证并保留了Cookie,也无法将这些Gmail Cookie存储在客户端的浏览器中。仅来自mail.google.com的请求可以设置Gmail cookie。这就是相同的原产地政策

If on the other hand you're trying to create some sort of single-sign-on service you're straight out of luck. Why is this? Well, even if your server manages to authenticate and persist cookies from Gmail, you have no way of storing these Gmail cookies in the client's browser. Only requests that originate from mail.google.com can set Gmail cookies. This is known as Same origin policy.

这篇关于使用Curl登录到Gmail收件箱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆