web services - How to send SMS to mobile phone from java program- Using free APIs or WebServices -
this question has answer here:
- how send sms in java 14 answers
i need write program should able send text sms mobile phone through java programming. got know far using sms gateways , connect modem sim card.
but cannot install sms gateways , modem on client machine. can use smtp
host.
how can use web service send sms?
your time , contribution highly appreciated.
using twilio sms gateway, can accomplish this.
import com.twilio.sdk.twiliorestclient; import com.twilio.sdk.twiliorestexception; import com.twilio.sdk.resource.factory.messagefactory; import com.twilio.sdk.resource.instance.message; import org.apache.http.namevaluepair; import org.apache.http.message.basicnamevaluepair; import java.util.arraylist; import java.util.list; public class example { // find account sid , token @ twilio.com/user/account public static final string account_sid = "ac32a3c49700934481addd5ce1659f04d2"; public static final string auth_token = "{{ auth_token }}"; public static void main(string[] args) throws twiliorestexception { twiliorestclient client = new twiliorestclient(account_sid, auth_token); // build filter messagelist list<namevaluepair> params = new arraylist<namevaluepair>(); params.add(new basicnamevaluepair("body", "abdul please?! show you")); params.add(new basicnamevaluepair("to", "+14159352345")); params.add(new basicnamevaluepair("from", "+14158141829")); messagefactory messagefactory = client.getaccount().getmessagefactory(); message message = messagefactory.create(params); system.out.println(message.getsid()); } }
here link twilio library: https://www.twilio.com/docs/java/install
Comments
Post a Comment