File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Fill a html form using java.

 
kamal krishna bhatt
Ranch Hand
Posts: 41
Eclipse IDE Java Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
using java code i need to hit a URL that opens a web page which contains log in/ password/description text boxes and i need to fill all these credentials.
how can i do that.
 
Arun Chidam
Ranch Hand
Posts: 79
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Kamal,

please see below a sample code to open the URL with login credentials, you need to invoke this code from a action event.

 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That will probably not work since the buffers are never read, so they will fill up causing your program to hang. Read more about that here. Also using platform specific code isn't really clean.

Remember that your browser just sends http requests and displays the result. From java you can easily send those http request as well. For instance look at HttpURLConnection.
 
kamal krishna bhatt
Ranch Hand
Posts: 41
Eclipse IDE Java Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what i actually need to do is i need to send some SMS on the basis of some event happens ,so to access that sms gateway first needed to give login credentials then i reach to have a SMS form in which i need to fill mobile no., sms content,maximum characters etc. and submit.
what i was looking for is to get the source for that page and set the values of specific attributes (i.e. user,password etc.) and submit the html form (as can be done in python) is there any way do that in java.
 
Arun Chidam
Ranch Hand
Posts: 79
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kamal krishna bhatt wrote:what i actually need to do is i need to send some SMS on the basis of some event happens ,so to access that sms gateway first needed to give login credentials then i reach to have a SMS form in which i need to fill mobile no., sms content,maximum characters etc. and submit.
what i was looking for is to get the source for that page and set the values of specific attributes (i.e. user,password etc.) and submit the html form (as can be done in python) is there any way do that in java.


Hi Kamal,

Does your SMS service provider accept SMS via email?, it is very simple if they have standard email to SMS conversion, where you send email as per their standard format and they recieve and process it as SMS request....message format should be something similiar as below....

TO : sms@messaging.xyz.com
Subj : SMS Message for 0XXXXXX id:XXXX user:XXX password:XXXXX to:XXXXXX text:XXXXXXXXX msg_type:SMS_TEXT

You can send the above message using javax.mail.Message API

Thanks
Arun
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't most (all?) SMS gateways provide an API?
 
Tarun Bolla
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi....

You dont need to meddle with GUI there!!

Wouter Oet wrote:
Remember that your browser just sends http requests and displays the result. From java you can easily send those http request as well. For instance look at HttpURLConnection.


He is correct. You want to look at the HttpURLConnection class. which will do Post or Get on a url and give you the returned HTML content. So that you can extract what ever you need from the obtained content. This is like AJAX if you are familiar with it.....

I think this is a better approach if there is no API for your SMS gateway. API would have done the same thing if there is one.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic