aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes really basic http post question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "really basic http post question" Watch "really basic http post question" New topic
Author

really basic http post question

Bobby Johanson
Greenhorn

Joined: May 15, 2012
Posts: 3
This question is not java specific. It is about http post which seems to be similiar across languages. I am not a web developer, however, I have been a DBA for over 10 years. I did do some java/servlet/jsp development in school, but that was 10 years ago. I am actually trying to get an http post macro to work on my android phone. I asked this on android forums and did not get a response. I think HTTP Post is general enough where if I am careful in how I word my question, I can ask it here. Please bare with me. I will try not to ramble. This is a VERY basic question.

I bought a macro/job scheduler tool for android called 'tasker'. I want to use it to log into my web email with a button click (and possibly other stuff. I want to figure out how http post works). you can do http post commands from tasker by filling out a screen. I am having trouble figuring out the parameters. I don't need coding syntax. Tasker does that for me. I need to populate a data field.

I want to do it this way in part because I want to figure out how http post works. There are probably other ways to get my email. I don't want to do this. I want to figure this out.


Website: http://webmail.verizon.net/signin/



so for data I think it is

IDToken1=myusername&IDToken2="mypassword"&

I need to pass the button name too right? What is that? and what are the key value pairs. I tried
btnSubmit=submit

and this doesn't work. I installed imacro and selenium to do some click recording to figure this out. but I can't get from the macro recorder code to what I pass to http post.


I think this is the snippet of code I need to pass the correct data.






William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 859

Not sure what you are trying to do... but ...

I would expect this to the SSL (hhtps)

and.

Sometimes you cannot POST outside of your own domain (cross site scripting etc.)

WP
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

William P O'Sullivan wrote:I would expect this to the SSL (hhtps)

The SSL protocol is https, not "hhtps".

Sometimes you cannot POST outside of your own domain (cross site scripting etc.)

You can always post outside the same domain. Whether the server will accept the post or not is another question.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bobby Johanson
Greenhorn

Joined: May 15, 2012
Posts: 3
please ignore the typo on the http or https. I can figure that part out. I'll number my questions.

1. I don't understand what this means?

"Sometimes you cannot POST outside of your own domain (cross site scripting etc.)"

I thought http post can be used to tell code to do an action on a form (including some other sites form) and http get, is used to get information or data from a form. So it could be used to get data someone inputs on your form or can be read from another web page. Am I misunderstanding this?

2. This is what I am trying to do. I want to send my username and password programmatically and then press the login button programmatically. What kind of command would I use to do it? I understand this isn't an android forum. Suppose I was to do this in java?

3. Here is a code snippet for http post I found? Is this kind of thing only useful in javascript for my form? I can't use this kind of code to press a button on another page?






Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Bobby Johanson wrote:
1. I don't understand what this means?

"Sometimes you cannot POST outside of your own domain (cross site scripting etc.)"

As I already pointed out, it doesn't mean anything. You can post wherever you like.

Just be aware that severs may be configured/coded to accept only posts from their own domain.
Bobby Johanson
Greenhorn

Joined: May 15, 2012
Posts: 3
if i want to test to see if the http post works. is it possible to use the http post command to log into a remote web page? if so, what do i need to pass in the http post command?
i think it is

username="myusername"&password="mypassword"

do I also pass the button?

what approach is better to take if i want to automatically log into a website? do i need to use javascript and onclick? I think you can inject javascript into websites with android, but I am not sure how.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

No quotes on the value in url-encoded bodies.

And I have no idea about Android, but if that's true.... wow!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: really basic http post question