0

Is there a way to preprogram your username and password in a php script such that when someone clicks on the link it takes them to the account logged in? I mostly just need to know how to format the link, but if that's not possible and I need to use curl I can (would like to know the code for redirecting to the logged in site as well).

This almost works (replacing LOGIN with my username and PASSWORD with my password), but I still have to enter the password and hit submit: https://www.google.com/accounts/ServiceLoginAuth?continue=http://google.com/voice&service=grandcentral&Email=LOGIN&Passwd=PASSWORD&null=Sign+in

emilyk
  • 713
  • 5
  • 14
  • 26
  • Checkout this similar question: http://stackoverflow.com/questions/8991873/login-to-google-with-php-and-curl-cookie-turned-off – Jose Vega Apr 23 '12 at 20:37
  • 3
    you can use CURL to do that. i've had good luck with CURL in php. you can basically 'emulate' the browser of your choice, set cookies, etc. Google is pretty smart though and if they don't want you doing something like this they'll shut you down before you even get out of the gate. they've already read and parsed this message – b_dubb Apr 23 '12 at 20:38

3 Answers3

0

Well if it works, you can just store email/password in an array and craft a URL,then redirect users to that URL.

It's a bad practice to hardcode passwors in scripts/programs. It's also a bad practice to send passwors in URL i.e. using GET method.

Manish
  • 4,903
  • 1
  • 29
  • 39
  • It's for a very select group of users on my website, and they need to add their own number to a google account that's only used for google voice. The only other option I have is give them the password in plain text...this seemed a little bit more discrete. – emilyk Apr 23 '12 at 20:55
  • If you can explain the whole scenario, we can provide a possible solution using cURL or probably using APIs. – Manish Apr 23 '12 at 21:03
  • Okay, I am designing a system that will call on-call employees when there is help needed. I've achieved this by adding their phone numbers as a forwarding number to a google voice account. When they sign up as a user, they need to set up their phone with google voice, and so they need to log into this account. I want to send them to the page where they can add the phone, bypassing having to type in the username and password since it will be the same for all of them. – emilyk Apr 23 '12 at 21:09
0

You can't login to Google this way. The closest you can get is setting up a form with hidden fields that posts to their server to log them in, but they check the referer header, so that doesn't work.

Brad
  • 159,648
  • 54
  • 349
  • 530
0

Use the login function I used in this class

https://github.com/hbattat/GeeVeeSMS

Sam Battat
  • 5,725
  • 1
  • 20
  • 29