1

I was searching different answers and examples online but could not find any that worked . Here is a real test Gmail account

User : gexvetrov
Pass : Yumorist1

How can I establish a connection to the gmail page using a post request and System.out.print the webpage ?


PS My question does not relate to Gmail only. I use this dummy gmail account to make my point and to explain more clearly what I want. I need to know if there is a way to make a post request to a webpage that has a <form> . I am using Selenium so far, but this is not efficient because the cpu wastes resources to support the browser. Is there any way I could you post request ?

Buras
  • 3,069
  • 28
  • 79
  • 126
  • now your new password is Yumorist2 (: Use Gmail's API instead of willing something like you want. That way is more secure, faster and lighter. Otherwise Gmail might detect your post requests and want you to enter ReCaptcha string or something else. – zkanoca Aug 23 '14 at 19:17

1 Answers1

1

You probably don't want to authenticate to Gmail through the login page that is intended for human users. Supposing that you succeed in logging in — then what? Are you going to screen-scrape the resulting inbox listing?

What you want to do instead is use the Gmail API. There is an explicit example there for how to authenticate and list the e-mail threads.

200_success
  • 7,286
  • 1
  • 43
  • 74
  • THank you. Actually I want to know if there is a way to send a post request using only a `form` . Now necessarily Gmail. I use Gmail to make my question clearer and more "feasible". Let's say any other webpage has a forms. I fill it out and click submit and get the result. Right now I am using `Selenium` to do this. But I was hoping there is an easier way to use HTTP Post – Buras Aug 23 '14 at 19:21
  • 1
    Then you've picked a poor example that makes it Unclear What You're Asking, because Gmail is quite complex. Maybe you want to read [Sending HTTP POST Request In Java](http://stackoverflow.com/q/3324717/1157100). – 200_success Aug 23 '14 at 19:27
  • Thanks. I restated my question http://stackoverflow.com/questions/25466182/how-to-submit-a-post-request-to-a-form – Buras Aug 23 '14 at 20:52