Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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.
 
Everybody! Do the Funky Monkey! Like this tiny ad!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic