• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Fill a html form using java.

 
Ranch Hand
Posts: 41
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't most (all?) SMS gateways provide an API?
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic