Hi can any one plz send me the java code for sending sms through some gateway plz reply this asap..or else plz assist me how to proceed..

Thanks,
Srinivas

Recommended Answers

All 8 Replies

Find an SMS Gateway (they provide internet service) and then read their documentation.

Have you even bothered searching through the forums, I bet not because I myself have answered the same question nearly two or three times and just in case you are in too much of a hurry to even type the search query here you go ;-
http://www.daniweb.com/search/search.php?q=send+sms+via+java

i searched but i didnt find any thing suitable..i need to write that code in myapplication.. i haven't find any smaple code which will help a bit..


Have you even bothered searching through the forums, I bet not because I myself have answered the same question nearly two or three times and just in case you are in too much of a hurry to even type the search query here you go ;-
http://www.daniweb.com/search/search.php?q=send+sms+via+java

they haven't provide any code or documentation for that ...

i searched but i didnt find any thing suitable..i need to write that code in myapplication.. i haven't find any smaple code which will help a bit..

Find an SMS Gateway (they provide internet service) and then read their documentation.

i searched but i didnt find any thing suitable..i need to write that code in myapplication.. i haven't find any smaple code which will help a bit..

Thats because you did not spend enough time looking.
You just searched for 6 minutes and expect to discover everything. Why do you want people to spoon feed you their code, their effort ?? While you do not even care to take the time to search through the forums.

BTW what API does your SMS Provider support HTTP, SMPP, CMG ???? You haven't even cared to mention that.

Im sorry... i have serched a lot before posting the original message..our SMS Provider supports HTTP, SMPP .now i need how to send sms from webserver to mobile through gateway..?


Thats because you did not spend enough time looking.
You just searched for 6 minutes and expect to discover everything. Why do you want people to spoon feed you their code, their effort ?? While you do not even care to take the time to search through the forums.

BTW what API does your SMS Provider support HTTP, SMPP, CMG ???? You haven't even cared to mention that.

they haven't provide any code or documentation for that ...

i searched but i didnt find any thing suitable..i need to write that code in myapplication.. i haven't find any smaple code which will help a bit..

You mean you didn't find anything you could block copy and paste.

The documentation describes how you interact with it (usually through http). So now the question is not "how do I send/receive sms", but rather "how do I perform an http connection/interaction". The answer to that is Http(s)URLConnection and another bit of Googling.

Gods, not everything you get will give you 1-to-1 examples of what you need to do in language "X". They will simply tell you what you need to do (I.E. use http protocol in "this manner"). Then it is up to you to implement that in language "X". So then you can start to research how to implement that.

Learn how to do a bit of thinking and research on your own or you will never be anything but a "code monkey" and not a very good one at that.

commented: Absolutely. +15

If you want to use the HTTP API the it is pretty straight forward, you will need to use the java.net.URL and java.net.URLConnection classes in Java.

Here is a Java tutorial on how to work with URLs.
http://java.sun.com/docs/books/tutorial/networking/urls/index.html

Also following is an example illustrating how to perform HTTP POST in Java.
http://www.exampledepot.com/egs/java.net/Post.html

For SMPP however there is no in built support in Java, so you will need to find one of third party libraries. OpenSMPP is one such library. You will need to download the source code and build it using ant. Once you buid it using "ant", you will get the "smpp.jar" in the dist folder, the smpp.jar needs to be present in the classpath while you are compiling any projects which will be using OpenSMPP . Also the javadocs for it will be generated in the "doc" folder, the javadocs contain a few examples on how to connect to an SMPP service provider to send messages / receive messages.

commented: Good info. +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.